At least note GBA port in readme

This commit is contained in:
UnknownShadow200 2025-12-13 08:03:11 +11:00
parent 119cacac0d
commit 4bd8d682c9
4 changed files with 70 additions and 22 deletions

View File

@ -40,16 +40,11 @@ CFLAGS = -g -Wall -O2 -DPLAT_GBA -ffunction-sections -fdata-sections -mcpu=arm7t
ASFLAGS = -g $(ARCH) ASFLAGS = -g $(ARCH)
LDFLAGS = -specs=gba.specs -g $(ARCH) LDFLAGS = -specs=gba.specs -g $(ARCH)
LIBS = -ltonc
LIBGBA := $(DEVKITPRO)/libgba LIBGBA := $(DEVKITPRO)/libgba
INCLUDES += $(foreach dir, $(LIBGBA), -I$(dir)/include) INCLUDES += $(foreach dir, $(LIBGBA), -I$(dir)/include)
LDFLAGS += $(foreach dir, $(LIBGBA), -L$(dir)/lib) LDFLAGS += $(foreach dir, $(LIBGBA), -L$(dir)/lib)
LIBTONC = $(DEVKITPRO)/libtonc
INCLUDES += $(foreach dir, $(LIBTONC), -I$(dir)/include)
LDFLAGS += $(foreach dir, $(LIBTONC), -L$(dir)/lib)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# Compiler tools # Compiler tools
@ -94,6 +89,9 @@ $(BUILD_DIR)/%.o: src/%.c
$(BUILD_DIR)/%.o: src/gba/%.c $(BUILD_DIR)/%.o: src/gba/%.c
$(ARM_CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@ $(ARM_CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: src/gba/%.S
$(ARM_CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# Dependency tracking # Dependency tracking

View File

@ -259,6 +259,14 @@ Run `make ds`. You'll need [BlocksDS](https://github.com/blocksds/sdk)
Run `make n64`. You'll need the opengl branch of [libdragon](https://github.com/DragonMinded/libdragon/tree/opengl) Run `make n64`. You'll need the opengl branch of [libdragon](https://github.com/DragonMinded/libdragon/tree/opengl)
#### GBA
Run `make gba`. You'll need [libgba](https://github.com/devkitPro/libgba)
**NOTE: It is highly recommended that you install the precompiled devkitpro packages from [here](https://devkitpro.org/wiki/Getting_Started) - you need the `gba-dev` group)**
**NOTE: The GBA port has terrible performance and is unusable in practice.**
</details> </details>
@ -462,6 +470,8 @@ Further information (e.g. style) for ClassiCube's source code can be found in th
* [ares](https://github.com/ares-emulator/ares) - Emulator used to test Nintendo 64 port * [ares](https://github.com/ares-emulator/ares) - Emulator used to test Nintendo 64 port
* [BlocksDS](https://github.com/blocksds/sdk) - Backend for Nintendo DS * [BlocksDS](https://github.com/blocksds/sdk) - Backend for Nintendo DS
* [melonDS](https://github.com/melonDS-emu/melonDS) - Emulator used to test Nintendo DS port * [melonDS](https://github.com/melonDS-emu/melonDS) - Emulator used to test Nintendo DS port
* [libgba](https://github.com/devkitPro/libgba) - Backend for GBA
* [mGBA](https://github.com/mgba-emu/mgba) - Emulator used to test GBA port
* [vitasdk](https://github.com/vitasdk) - Backend for PS Vita * [vitasdk](https://github.com/vitasdk) - Backend for PS Vita
* [Vita3K](https://github.com/Vita3K/Vita3K) - Emulator used to test Vita port * [Vita3K](https://github.com/Vita3K/Vita3K) - Emulator used to test Vita port
* [pspsdk](https://github.com/pspdev/pspsdk) - Backend for PSP * [pspsdk](https://github.com/pspdev/pspsdk) - Backend for PSP

22
src/gba/NocashLog.S Normal file
View File

@ -0,0 +1,22 @@
.global nocash_log
.global nocash_msg
// BEG nocash_log
.section .ewram,"ax",%progbits
.thumb_func
.align 2
// nocash looks for this specific pattern
nocash_log:
mov r12, r12
b nocash_log_return
.short 0x6464, 0x0000
nocash_msg:
.space 82
nocash_log_return:
bx lr
.size nocash_log, .-nocash_log
.type nocash_log, %function
// END nocash_log

View File

@ -139,35 +139,53 @@ cc_uint64 Stopwatch_Measure(void) {
return base_time + raw; return base_time + raw;
} }
extern int nocash_puts(const char *str);
static void Log_Nocash(char* buffer) {
nocash_puts(buffer);
}
#define MGBA_LOG_DEBUG 4 #define MGBA_LOG_DEBUG 4
#define REG_DEBUG_ENABLE (vu16*)0x4FFF780 #define REG_DEBUG_ENABLE (vu16*)0x4FFF780
#define REG_DEBUG_FLAGS (vu16*)0x4FFF700 #define REG_DEBUG_FLAGS (vu16*)0x4FFF700
#define REG_DEBUG_STRING (char*)0x4FFF600 #define REG_DEBUG_STRING (char*)0x4FFF600
static void Log_mgba(char* buffer, int len) { static void Log_mgba(const char* msg, int len) {
*REG_DEBUG_ENABLE = 0xC0DE; *REG_DEBUG_ENABLE = 0xC0DE;
// Check if actually emulated or not // Check if actually emulated or not
if (*REG_DEBUG_ENABLE != 0x1DEA) return; if (*REG_DEBUG_ENABLE != 0x1DEA) return;
Mem_Copy(REG_DEBUG_STRING, buffer, len); while (len)
*REG_DEBUG_FLAGS = MGBA_LOG_DEBUG | 0x100; {
// Can only be up to 120 bytes total
int bit = min(len, 119);
char* dst = REG_DEBUG_STRING;
Mem_Copy(dst, msg, bit);
dst[bit] = '\0';
*REG_DEBUG_FLAGS = MGBA_LOG_DEBUG | 0x100;
msg += bit; len -= bit;
}
} }
void Platform_Log(const char* msg, int len) { // Log to nocash debugger
// Can only be up to 120 bytes total extern char nocash_msg[82];
char buffer[120]; extern void nocash_log(void);
len = min(len, 118);
Mem_Copy(buffer, msg, len); static void Log_Nocash(const char* msg, int len) {
buffer[len + 0] = '\n'; while (len)
buffer[len + 1] = '\0'; {
Log_Nocash(buffer); // Can only be up to 80 bytes total
Log_mgba(buffer, len); int bit = min(len, 80);
char* dst = nocash_msg;
Mem_Copy(dst, msg, bit);
dst[bit + 0] = '\0';
nocash_log();
msg += bit; len -= bit;
}
}
void Platform_Log(const char* msg, int len) {
Log_mgba(msg, len);
Log_Nocash(msg, len);
} }
TimeMS DateTime_CurrentUTC(void) { TimeMS DateTime_CurrentUTC(void) {