Skip to content

Commit 015024c

Browse files
committed
atari800-3ds 0.3.8, fix #3
1 parent 2092795 commit 015024c

File tree

5 files changed

+32
-4
lines changed

5 files changed

+32
-4
lines changed

Makefile.3ds

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ INCLUDES := src
3434
ROMFS := src/3ds/romfs
3535

3636
APP_TITLE=atari800
37-
APP_VERSION=0.3.7
37+
APP_VERSION=0.3.8
3838
APP_DESCRIPTION=\"Atari 8-bit computer emulator ($(APP_VERSION))\"
3939
APP_AUTHOR=\"atari800 development team\"
4040
ICON = src/3ds/banner/atari800-icon.png
@@ -218,7 +218,8 @@ $(BUILD):
218218
clean:
219219
@echo clean ...
220220
@rm -fr $(BUILD) $(TARGET).3dsx $(OUTPUT).smdh $(TARGET).elf
221-
@rm -fr src/*.d src/*.o src/3ds/*.d src/3ds/*.o
221+
@rm -fr src/*.d src/*.o src/3ds/*.d src/3ds/*.o src/codecs/*.d src/codecs/*.o
222+
@rm -fr src/roms/*.d src/roms/*.o
222223

223224

224225
#---------------------------------------------------------------------------------

src/3ds/config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@
405405
#define PACKAGE_NAME "Atari800"
406406

407407
/* Define to the full name and version of this package. */
408-
#define PACKAGE_STRING "Atari800 git (2022-04-24)"
408+
#define PACKAGE_STRING "Atari800 git (2022-06-06)"
409409

410410
/* Define to the one symbol short name of this package. */
411411
#define PACKAGE_TARNAME "atari800"
@@ -414,7 +414,7 @@
414414
#define PACKAGE_URL ""
415415

416416
/* Define to the version of this package. */
417-
#define PACKAGE_VERSION "3DS 0.3.6"
417+
#define PACKAGE_VERSION "3DS 0.3.8"
418418

419419
/* Define to use page-based attribute array. */
420420
#define PAGED_ATTRIB 1

src/3ds/main.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424

2525
#include <3ds.h>
2626
#include <citro3d.h>
27+
#include <malloc.h>
2728
#include <stdio.h>
29+
#include <stdlib.h>
2830
#include <string.h>
2931

3032
/* Atari800 includes */
@@ -43,9 +45,24 @@
4345
#include "videomode.h"
4446

4547
static bool PLATFORM_IsNew3DS;
48+
static u32 PLATFORM_NetworkInitialized = 0;
49+
static u32 *PLATFORM_SocketBuffer;
4650

4751
extern int dpad_as_keyboard;
4852

53+
void PLATFORM_InitNetwork(void)
54+
{
55+
if (PLATFORM_NetworkInitialized == 0) {
56+
PLATFORM_SocketBuffer = (u32*) memalign(0x1000, 0x80000);
57+
PLATFORM_NetworkInitialized = 1;
58+
if (PLATFORM_SocketBuffer != NULL) {
59+
if (socInit(PLATFORM_SocketBuffer, 0x80000) == 0) {
60+
PLATFORM_NetworkInitialized = 2;
61+
}
62+
}
63+
}
64+
}
65+
4966
int PLATFORM_Configure(char *option, char *parameters)
5067
{
5168
if (strcmp(option, "N3DS_DPAD_MODE") == 0)
@@ -92,6 +109,11 @@ int PLATFORM_Exit(int run_monitor)
92109
if (run_monitor) {
93110
return 1;
94111
} else {
112+
if (PLATFORM_NetworkInitialized >= 2) {
113+
socExit();
114+
free(PLATFORM_SocketBuffer);
115+
}
116+
95117
N3DS_ExitVideo();
96118

97119
romfsExit();

src/platform.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
/* This include file defines prototypes for platform-specific functions. */
1515

16+
void PLATFORM_InitNetwork(void);
17+
1618
int PLATFORM_Initialise(int *argc, char *argv[]);
1719
int PLATFORM_Exit(int run_monitor);
1820
int PLATFORM_Keyboard(void);

src/rdevice.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
*/
7474

7575
#include "config.h"
76+
#include "platform.h"
7677
#include <stdio.h>
7778
#include <stdlib.h>
7879
#include <string.h>
@@ -746,6 +747,8 @@ static void open_connection(char * address, int port)
746747
#endif /* HAVE_WINDOWS_H */
747748
if((address != NULL) && (strlen(address) > 0))
748749
{
750+
PLATFORM_InitNetwork();
751+
749752
close(rdev_fd);
750753
close(sock);
751754
do_once = 1;

0 commit comments

Comments
 (0)