Skip to content

Commit

Permalink
support SYSTEM_MODE 80M game for old 3DS
Browse files Browse the repository at this point in the history
  • Loading branch information
dnasdw committed Aug 7, 2018
1 parent 4f42100 commit 3f604ae
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ cmake-build-debug
CMakeLists.txt

build
build_big
output
output_big
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ LIBRARY_DIRS :=
LIBRARIES :=

BUILD_FLAGS :=
BUILD_FLAGS_CC :=
BUILD_FLAGS_CC := -DSFTSYSTEM_MODE=64
BUILD_FLAGS_CXX :=
RUN_FLAGS :=

VERSION_MAJOR := 2
VERSION_MAJOR := 3
VERSION_MINOR := 0
VERSION_MICRO := 0

Expand Down
72 changes: 72 additions & 0 deletions Makefile_big
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# TARGET #

TARGET := 3DS
LIBRARY := 0

ifeq ($(TARGET),$(filter $(TARGET),3DS WIIU))
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro")
endif
endif

# COMMON CONFIGURATION #

NAME := SFontT80

BUILD_DIR := build_big
OUTPUT_DIR := output_big
INCLUDE_DIRS := include
SOURCE_DIRS := source

EXTRA_OUTPUT_FILES :=

LIBRARY_DIRS :=
LIBRARIES :=

BUILD_FLAGS :=
BUILD_FLAGS_CC := -DSFTSYSTEM_MODE=80
BUILD_FLAGS_CXX :=
RUN_FLAGS :=

VERSION_MAJOR := 3
VERSION_MINOR := 0
VERSION_MICRO := 0

# 3DS/Wii U CONFIGURATION #

ifeq ($(TARGET),$(filter $(TARGET),3DS WIIU))
TITLE := $(NAME)
DESCRIPTION := Big Shared Font Tool
AUTHOR := dnasdw and enler
endif

# 3DS CONFIGURATION #

ifeq ($(TARGET),3DS)
LIBRARY_DIRS += $(DEVKITPRO)/libctru
LIBRARIES += ctru

PRODUCT_CODE := CTR-P-BSFA
UNIQUE_ID := 0xF0002

CATEGORY := Application
USE_ON_SD := true

MEMORY_TYPE := Application
SYSTEM_MODE := 80MB
SYSTEM_MODE_EXT := Legacy
CPU_SPEED := 268MHz
ENABLE_L2_CACHE := true

ICON_FLAGS :=

ROMFS_DIR := romfs
BANNER_AUDIO := meta/audio_3ds.wav
BANNER_IMAGE := meta/banner_3ds_big.png
ICON := meta/icon_3ds_big.png
LOGO := meta/logo.darc.lz
endif

# INTERNAL #

include buildtools/make_base
3 changes: 3 additions & 0 deletions build_big.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
make -f Makefile_big clean
make -f Makefile_big
PAUSE
Binary file modified meta/banner_3ds.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added meta/banner_3ds_big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified meta/icon_3ds.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added meta/icon_3ds_big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 33 additions & 4 deletions source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ typedef struct FontCodeMap
} __attribute__((packed)) FontCodeMap;

#define CONVERT_ENDIAN(n) (((n) >> 24 & 0xFF) | ((n) >> 8 & 0xFF00) | (((n) & 0xFF00) << 8) | (((n) & 0xFF) << 24))
#if SFTSYSTEM_MODE == 64
#define ADDRESS_NON_NEW_3DS 0x18000000
#elif SFTSYSTEM_MODE == 80
#define ADDRESS_NON_NEW_3DS 0x19000000
#endif
#define ADDRESS_NEW_3DS 0x1bc00000
#define GSP_HEAP_START_OFFSET_DEFAULT 0x14000000
#define GSP_HEAP_START_OFFSET_FIRM80 0x30000000
Expand Down Expand Up @@ -344,8 +348,12 @@ int main(int argc, char* argv[])
consoleInit(GFX_TOP, &g_TopScreen);
consoleInit(GFX_BOTTOM, &g_BottomScreen);
romfsInit();
const char* pTitle = "Shared Font Tool v2.0";
const char* pAuthors = "dnasdw, enler";
#if SFTSYSTEM_MODE == 64
const char* pTitle = "Shared Font Tool v3.0";
#elif SFTSYSTEM_MODE == 80
const char* pTitle = "Big Shared Font Tool v3.0";
#endif
const char* pAuthors = "dnasdw and enler";
consoleSelect(&g_BottomScreen);
// bottom 2,1
printf("\E[%d;1H", g_nBottomCurrentLine++);
Expand Down Expand Up @@ -388,6 +396,13 @@ int main(int argc, char* argv[])
// top 5,6
printf("\E[%d;6H""New3DS: %s", g_nTopCurrentLine++, g_bNew3DS ? "true" : "false");
initSharedFontType();
s32 nExitPossibility = 2;
if (!g_bNew3DS)
{
#if SFTSYSTEM_MODE == 64
nExitPossibility = 0;
#endif
}
s32 nRecoverPossibility = g_uSharedFontType == SHARED_FONT_TYPE_STD || g_uSharedFontType == SHARED_FONT_TYPE_CN || g_uSharedFontType == SHARED_FONT_TYPE_KR || g_uSharedFontType == SHARED_FONT_TYPE_TW ? 2 : 0;
s32 nChangeFontPossibility[FONT_COUNT] = {};
nChangeFontPossibility[0] = g_uSharedFontType == SHARED_FONT_TYPE_STD || g_uSharedFontType == SHARED_FONT_TYPE_CN || g_uSharedFontType == SHARED_FONT_TYPE_KR || g_uSharedFontType == SHARED_FONT_TYPE_TW ? 2 : 0;
Expand Down Expand Up @@ -476,7 +491,18 @@ int main(int argc, char* argv[])
// top 28,6
printf("\E[%d;6H""\E[0;%dm""Press SELECT : recover font""\E[0m", g_nTopCurrentLine++, nColor[nRecoverPossibility]);
// top 29,6
printf("\E[%d;6H""Press START : exit", g_nTopCurrentLine++);
if (g_bNew3DS)
{
printf("\E[%d;6H""Press START : exit", g_nTopCurrentLine++);
}
else
{
#if SFTSYSTEM_MODE == 64
printf("\E[%d;6H""Press START : exit", g_nTopCurrentLine++);
#else
printf("\E[%d;6H""Press HOME : for start the game manually", g_nTopCurrentLine++);
#endif
}
clearTop();
consoleSelect(&g_BottomScreen);
while (aptMainLoop())
Expand All @@ -486,7 +512,10 @@ int main(int argc, char* argv[])
u32 uKeysDown = hidKeysDown();
if ((uKeysDown & KEY_START) != 0)
{
break;
if (nExitPossibility != 0)
{
break;
}
}
else if ((uKeysDown & KEY_SELECT) != 0)
{
Expand Down

0 comments on commit 3f604ae

Please sign in to comment.