Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ It remains a homebrew GBA emulator — you need a legal BIOS dump (`gba_bios.bin
- **Carousel mode** — Alternative 3D-style ROM browser with boxart and savestate screenshot previews. Folders can also display boxart using the separate `folder_boxart_directory` setting in `dir.ini`. Toggle between list view and carousel view in the file browser.
- **Recent ROMs** — Up to 5 recently played games appear at the top of the file browser for quick re-launch. Saved automatically between sessions.
- **Internationalization** — menu strings in **Japanese, English, Simplified Chinese, Traditional Chinese, and Italian**.
- Chinese filename support via GBK codepage plugin (approach from [eleqian's TempGBA4PSP-cc](https://github.com/lakent/TempGBA4PSP-cc)).
- **Confirm button swap** — choose **O confirms** or **X confirms** (PSP-region style). Older `tempgba.cfg` files written before these slots were added still load correctly.
- **Savestates** — 10 manual slots plus an automatic slot that saves when you exit the emulator, put the PSP to sleep, load a new ROM, or load a different savestate.
- **Savestate UX** — details save/load fixes; leaving the menu after state operations behaves more predictably.
Expand Down Expand Up @@ -278,8 +279,10 @@ Artifacts (`EBOOT.PBP`, `TempGBA.prx`, etc.) are written under `source/` on the
- **libretro/gpsp** — upstream accuracy and renderer fixes ported into this tree
- **UI themes / i18n / X/O swap** — contributors to PR #20
- **Single-game layout** — compatible with [GrabowskiDev/TempGBA4PSP-Single-game](https://github.com/GrabowskiDev/TempGBA4PSP-Single-game)
- **GBK codepage plugin & unified font rendering** — [eleqian](https://gitee.com/eleqian) / [lakent/TempGBA4PSP-cc](https://github.com/lakent/TempGBA4PSP-cc)
- **PSP sleep/resume power management** — [Piero Carrieri / GBA-Rush-PSP](https://github.com/redcode9/GBA-Rush-PSP)
- **This mod** — [andymcca/TempGBA4PSP-mod](https://github.com/andymcca/TempGBA4PSP-mod)
- **Contributions** — [JxPv2](https://github.com/JxPv2) (single-game launcher builder tool and launcher stub, GUI improvements, boxart and recent ROMs)
- **Contributions** — [JxPv2](https://github.com/JxPv2) (single-game launcher builder tool and launcher stub, GUI improvements, boxart and recent ROMs, language display fixes, GBK integration)

---

Expand Down
8 changes: 5 additions & 3 deletions source/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ EXTRA_TARGETS = EBOOT.PBP

COMMON_FILE = \
common.h \
cpu.h memory.h video.h psp_video.h input.h sound.h main.h message.h mh_print.h gui.h zip.h png.h \
cpu.h memory.h video.h psp_video.h input.h sound.h main.h message.h gui.h zip.h png.h \
ku_bridge.h exception.h ch_print.h

MAINOBJS = \
cpu.o memory.o video_dispatch.o video_cc_wrap.o video_old_wrap.o psp_video.o input.o sound.o main.o message.o mh_print.o gui.o zip.o png.o \
cpu.o memory.o video_dispatch.o video_cc_wrap.o video_old_wrap.o psp_video.o input.o sound.o main.o message.o gui.o zip.o png.o \
mips_stub.o video_blend_mips.o \
ku_bridge.o exception.o cheats.o ch_print.o \
boxart.o
boxart.o power_lifecycle.o

OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
Expand Down Expand Up @@ -63,3 +63,5 @@ LDFLAGS += -flto
all: $(EXTRA_TARGETS)
@$(MAKE) -C prx/exceptionHandler/prx
@cp prx/exceptionHandler/prx/exception.prx .
@$(MAKE) -C prx/cp_fix_gbk
@cp prx/cp_fix_gbk/cp_fix_gbk.prx .
22 changes: 22 additions & 0 deletions source/prx/cp_fix_gbk/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# cp_fix_gbk — based on eleqian's TempGBA4PSP-cc
# https://github.com/lakent/TempGBA4PSP-cc (mirror of https://gitee.com/eleqian)

TARGET = cp_fix_gbk
OBJS = main.o exports.o

INCDIR = ../../SDK/include
CFLAGS = -O2 -Os -G0 -Wall -fshort-wchar -fno-pic -mno-check-zero-division
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

BUILD_PRX = 1
PRX_EXPORTS = exports.exp

USE_KERNEL_LIBC = 1
USE_KERNEL_LIBS = 1

LIBDIR = ../../SDK/lib
LIBS = -lpspsystemctrl_kernel

PSPSDK = $(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build_prx.mak
12 changes: 12 additions & 0 deletions source/prx/cp_fix_gbk/exports.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* cp_fix_gbk — based on eleqian's TempGBA4PSP-cc
* https://github.com/lakent/TempGBA4PSP-cc (mirror of https://gitee.com/eleqian)
*/

PSP_BEGIN_EXPORTS

PSP_EXPORT_START(syslib, 0, 0x8000)
PSP_EXPORT_FUNC(module_start)
PSP_EXPORT_VAR(module_info)
PSP_EXPORT_END

PSP_END_EXPORTS
72 changes: 72 additions & 0 deletions source/prx/cp_fix_gbk/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/* cp_fix_gbk — based on eleqian's TempGBA4PSP-cc
* https://github.com/lakent/TempGBA4PSP-cc (mirror of https://gitee.com/eleqian)
*/

#include <pspsdk.h>
#include "systemctrl.h"

PSP_MODULE_INFO("cp_fix_gbk", 0x1007, 1, 0);

#define CP000 0x00
#define CP437 0x01
#define CP850 0x05
#define CP866 0x0b
#define CP932 0x0d
#define CP936 0x0e
#define CP949 0x0f
#define CP950 0x10
#define CP1251 0x12
#define CP1252 0x13

#define MAKE_JUMP(a, f) _sw(0x08000000 | (((u32)(f) & 0x0FFFFFFC) >> 2), a);

//by Davee
#define HIJACK_FUNCTION(a, f, ptr) \
{ \
u32 _func_ = a; \
static u32 patch_buffer[3]; \
_sw(_lw(_func_), (u32)patch_buffer); \
_sw(_lw(_func_ + 4), (u32)patch_buffer + 8);\
MAKE_JUMP((u32)patch_buffer + 4, _func_ + 8); \
_sw(0x08000000 | (((u32)(f) >> 2) & 0x03FFFFFF), _func_); \
_sw(0, _func_ + 4); \
ptr = (void *)patch_buffer; \
}

int (*sceCodepage_set_cp)(u32 cp);
u32 last_cp = 0xff;

int sceCodepage_set_cp_pathed(u32 cp)
{
if (cp == CP932) {
cp = CP936;
}
if (last_cp == cp) {
return 0;
}
return sceCodepage_set_cp(cp);
}

void hook_codepage(void)
{
u32 func = sctrlHENFindFunction("sceCodepage_Service", "sceCodepage_driver", 0xB0AE63AA);
if (func == 0) {
return;
}

HIJACK_FUNCTION(func, sceCodepage_set_cp_pathed, sceCodepage_set_cp);

sceKernelDcacheWritebackAll();
sceKernelIcacheClearAll();
}

int module_start(SceSize args, void *argp)
{
hook_codepage();
return 0;
}

int module_stop(void)
{
return 0;
}
31 changes: 31 additions & 0 deletions source/src/ch_print.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,36 @@
#define FONT_BTN_SQUARE_FILL_GBK "\xA1\xF6"
#define FONT_BTN_CIRCLE_FILL_GBK "\xA1\xF1"

// Aliases for legacy macros used in message files and gui.c
#define FONT_BATTERY0 FONT_BATTERY0_GBK
#define FONT_BATTERY1 FONT_BATTERY1_GBK
#define FONT_BATTERY2 FONT_BATTERY2_GBK
#define FONT_BATTERY3 FONT_BATTERY3_GBK
#define FONT_GBA_ICON FONT_GBA_ICON_GBK
#define FONT_PSP_ICON FONT_PSP_ICON_GBK
#define FONT_MSC_ICON FONT_MSC_ICON_GBK
#define FONT_OPT_ICON FONT_OPT_ICON_GBK
#define FONT_PAD_ICON FONT_PAD_ICON_GBK
#define FONT_KEY_ICON FONT_KEY_ICON_GBK
#define FONT_R_TRIGGER FONT_R_TRIGGER_GBK
#define FONT_L_TRIGGER FONT_L_TRIGGER_GBK
#define FONT_CURSOR_RIGHT FONT_CURSOR_RIGHT_GBK
#define FONT_CURSOR_LEFT FONT_CURSOR_LEFT_GBK
#define FONT_CURSOR_UP FONT_CURSOR_UP_GBK
#define FONT_CURSOR_DOWN FONT_CURSOR_DOWN_GBK
#define FONT_CURSOR_RIGHT_FILL FONT_CURSOR_RIGHT_FILL_GBK
#define FONT_CURSOR_LEFT_FILL FONT_CURSOR_LEFT_FILL_GBK
#define FONT_CURSOR_UP_FILL FONT_CURSOR_UP_FILL_GBK
#define FONT_CURSOR_DOWN_FILL FONT_CURSOR_DOWN_FILL_GBK
#define FONT_UP_DIRECTORY FONT_UP_DIRECTORY_GBK

#define FONT_BTN_TRIANGLE FONT_BTN_TRIANGLE_GBK
#define FONT_BTN_SQUARE FONT_BTN_SQUARE_GBK
#define FONT_BTN_CIRCLE FONT_BTN_CIRCLE_GBK
#define FONT_BTN_CROSS FONT_BTN_CROSS_GBK
#define FONT_BTN_TRIANGLE_FILL FONT_BTN_TRIANGLE_FILL_GBK
#define FONT_BTN_SQUARE_FILL FONT_BTN_SQUARE_FILL_GBK
#define FONT_BTN_CIRCLE_FILL FONT_BTN_CIRCLE_FILL_GBK

void ch_print(const char *str, u16 x, u16 y, u16 col, s16 bg_col, u16 *base_vram, u16 bufferwidth);

1 change: 0 additions & 1 deletion source/src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ typedef u32 FIXED08_24;

#include "cheats.h"

#include "mh_print.h"
#include "ch_print.h"
#include "gui.h"

Expand Down
Loading