mirror of
https://github.com/libretro/TempGBA-libretro.git
synced 2026-10-25 22:49:56 +00:00
remove message.c/h and zip.c/h
This commit is contained in:
1 parent
8eacf9fc9b
commit
084afce4b8
14 files changed
+94
-1058
No files matched your search
@@ -24,8 +24,14 @@ CFLAGS += -D__LIBRETRO__ -DPSP
|
||||
|
||||
CFLAGS += -D_PSP_FW_VERSION=371
|
||||
|
||||
OBJS := cpu.o mips_stub.o message.o zip.o libretro.o input.o
|
||||
OBJS += main.o memory.o video.o sound.o
|
||||
OBJS := mips_stub.o
|
||||
|
||||
#OBJS += griffin.o
|
||||
|
||||
OBJS += cpu.o
|
||||
OBJS += libretro.o input.o
|
||||
OBJS += main.o memory.o video.o
|
||||
OBJS += sound.o
|
||||
|
||||
INCDIRS := -I.
|
||||
INCDIRS += -I$(shell psp-config --pspsdk-path)/include
|
||||
|
||||
@@ -137,11 +137,6 @@ typedef u32 FIXED08_24;
|
||||
*((u32 *)((u8 *)(base) + (offset))) \
|
||||
|
||||
|
||||
#include "zlib.h"
|
||||
#include "zip.h"
|
||||
|
||||
#include "message.h"
|
||||
|
||||
#include "cpu.h"
|
||||
#include "memory.h"
|
||||
#include "video.h"
|
||||
@@ -149,4 +144,6 @@ typedef u32 FIXED08_24;
|
||||
#include "sound.h"
|
||||
#include "main.h"
|
||||
|
||||
void switch_to_main_thread(void);
|
||||
|
||||
#endif /* COMMON_H */
|
||||
@@ -2797,7 +2797,7 @@ static void thumb_flag_status(BlockDataThumbType *block_data, u16 opcode)
|
||||
{ \
|
||||
char buffer[80]; \
|
||||
sprintf(buffer, "bad jump %08x (%08x)", (int)pc, (int)reg[REG_PC]); \
|
||||
print_string(buffer, 6, 6, COLOR15_WHITE, COLOR15_BLACK); \
|
||||
info_msg(buffer); \
|
||||
quit(); \
|
||||
} \
|
||||
block_address = (u8 *)NULL; \
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#include "cpu.c"
|
||||
#include "libretro.c"
|
||||
#include "input.c"
|
||||
#include "main.c"
|
||||
#include "memory.c"
|
||||
#include "video.c"
|
||||
#include "sound.c"
|
||||
+20
-7
@@ -41,7 +41,7 @@ static int cpu_thread_entry(SceSize args, void* argp)
|
||||
static inline void init_context_switch(void)
|
||||
{
|
||||
main_thread = sceKernelGetThreadId();
|
||||
cpu_thread = sceKernelCreateThread ("CPU thread", cpu_thread_entry, 0x10, 0x20000, 0, NULL);
|
||||
cpu_thread = sceKernelCreateThread ("CPU thread", cpu_thread_entry, 0x12, 0x20000, 0, NULL);
|
||||
sceKernelStartThread(cpu_thread, 0, NULL);
|
||||
}
|
||||
|
||||
@@ -123,6 +123,19 @@ bool retro_unserialize(const void *data, size_t size)
|
||||
void retro_cheat_reset() {}
|
||||
void retro_cheat_set(unsigned index, bool enabled, const char *code) {}
|
||||
|
||||
void error_msg(const char *text)
|
||||
{
|
||||
if (log_cb)
|
||||
log_cb(RETRO_LOG_ERROR, text);
|
||||
}
|
||||
|
||||
void info_msg(const char *text)
|
||||
{
|
||||
if (log_cb)
|
||||
log_cb(RETRO_LOG_INFO, text);
|
||||
}
|
||||
|
||||
|
||||
#include "pspdisplay.h"
|
||||
|
||||
bool retro_load_game(const struct retro_game_info *info)
|
||||
@@ -146,7 +159,7 @@ bool retro_load_game(const struct retro_game_info *info)
|
||||
|
||||
if (load_bios(filename_bios) < 0)
|
||||
{
|
||||
error_msg(MSG[MSG_ERR_BIOS_NONE], CONFIRMATION_QUIT);
|
||||
error_msg("Could not load BIOS image file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -158,7 +171,7 @@ bool retro_load_game(const struct retro_game_info *info)
|
||||
|
||||
if (load_gamepak(info->path) < 0)
|
||||
{
|
||||
error_msg(MSG[MSG_ERR_LOAD_GAMEPACK], CONFIRMATION_CONT);
|
||||
error_msg("Could not load the game file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -211,7 +224,6 @@ void retro_run()
|
||||
{
|
||||
bool updated = false;
|
||||
|
||||
static bool firstrun = true;
|
||||
input_poll_cb();
|
||||
|
||||
|
||||
@@ -220,6 +232,7 @@ void retro_run()
|
||||
|
||||
|
||||
#ifdef SINGLE_THREAD
|
||||
static bool firstrun = true;
|
||||
static u32 mips_regs[32];
|
||||
__asm__ volatile (
|
||||
".set push \n"
|
||||
@@ -248,11 +261,11 @@ void retro_run()
|
||||
firstrun = false;
|
||||
// reg[CPU_HALT_STATE] = CPU_ACTIVE;
|
||||
// reg[CHANGED_PC_STATUS] = 0;
|
||||
execute_arm_translate(reg[EXECUTE_CYCLES]);
|
||||
// execute_arm_translate(reg[EXECUTE_CYCLES]);
|
||||
}
|
||||
else
|
||||
{
|
||||
resume_cpu_loop();
|
||||
// resume_cpu_loop();
|
||||
// io_update_gba(reg[EXECUTE_CYCLES]);
|
||||
// __asm__ volatile (
|
||||
// ".set push \n"
|
||||
@@ -350,7 +363,7 @@ void retro_run()
|
||||
|
||||
|
||||
sceRtcGetCurrentTick(&end_tick);
|
||||
printf("frame time : %u\n", (uint32_t)(end_tick - start_tick));
|
||||
// printf("frame time : %u\n", (uint32_t)(end_tick - start_tick));
|
||||
|
||||
render_audio();
|
||||
|
||||
|
||||
@@ -535,12 +535,6 @@ void change_ext(char *src, char *buffer, const char *extension)
|
||||
}
|
||||
}
|
||||
|
||||
void error_msg(const char *text, u8 confirm)
|
||||
{
|
||||
//todo
|
||||
}
|
||||
|
||||
|
||||
SceUID psp_fopen(const char *filename, const char *mode)
|
||||
{
|
||||
SceUID tag;
|
||||
@@ -586,7 +580,7 @@ void *safe_malloc(size_t size)
|
||||
|
||||
if ((p = memalign(MEM_ALIGN, size)) == NULL)
|
||||
{
|
||||
error_msg(MSG[MSG_ERR_MALLOC], CONFIRMATION_QUIT);
|
||||
error_msg("Could not allocate memory.");
|
||||
quit();
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,9 @@ u32 update_gba(void);
|
||||
void reset_gba(void);
|
||||
void quit(void);
|
||||
|
||||
void error_msg(const char *text, u8 confirm);
|
||||
void error_msg(const char *text);
|
||||
void info_msg(const char *text);
|
||||
|
||||
void change_ext(char *src, char *buffer, const char *extension);
|
||||
|
||||
u32 file_length(const char *filename);
|
||||
|
||||
@@ -276,14 +276,14 @@ static u32 evict_gamepak_page(void);
|
||||
static void get_backup_id(void);
|
||||
|
||||
char backup_filename[MAX_FILE];
|
||||
static u32 save_backup(char *name);
|
||||
//static u32 save_backup(char *name);
|
||||
|
||||
static u32 encode_bcd(u8 value);
|
||||
|
||||
#define SAVESTATE_SIZE 0x80000 // 512K Byte (524288 Byte)
|
||||
u8 *write_mem_ptr;
|
||||
static void memory_write_mem_savestate(SceUID savestate_file);
|
||||
static void memory_read_savestate(SceUID savestate_file);
|
||||
//static void memory_write_mem_savestate(SceUID savestate_file);
|
||||
//static void memory_read_savestate(SceUID savestate_file);
|
||||
|
||||
|
||||
u8 *read_rom_block = NULL;
|
||||
@@ -1588,6 +1588,8 @@ CPU_ALERT_TYPE write_io_register16(u32 address, u32 value)
|
||||
|
||||
// Sound FIFO A
|
||||
case 0xA0:
|
||||
// ADDRESS16(io_registers, address) = value;
|
||||
// break;
|
||||
case 0xA2:
|
||||
ADDRESS16(io_registers, address) = value;
|
||||
sound_timer_queue(0);
|
||||
@@ -1595,6 +1597,8 @@ CPU_ALERT_TYPE write_io_register16(u32 address, u32 value)
|
||||
|
||||
// Sound FIFO B
|
||||
case 0xA4:
|
||||
// ADDRESS16(io_registers, address) = value;
|
||||
// break;
|
||||
case 0xA6:
|
||||
ADDRESS16(io_registers, address) = value;
|
||||
sound_timer_queue(1);
|
||||
@@ -2656,7 +2660,7 @@ void init_gamepak_buffer(void)
|
||||
|
||||
if (gamepak_ram_buffer_size == 0)
|
||||
{
|
||||
error_msg(MSG[MSG_ERR_MALLOC], CONFIRMATION_QUIT);
|
||||
error_msg("Could not allocate memory.");
|
||||
quit();
|
||||
}
|
||||
|
||||
@@ -3006,49 +3010,49 @@ s32 load_backup(char *name)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static u32 save_backup(char *name)
|
||||
{
|
||||
SceUID backup_file;
|
||||
char backup_path[MAX_PATH];
|
||||
//static u32 save_backup(char *name)
|
||||
//{
|
||||
// SceUID backup_file;
|
||||
// char backup_path[MAX_PATH];
|
||||
|
||||
u32 backup_size = 0;
|
||||
// u32 backup_size = 0;
|
||||
|
||||
if (backup_type != BACKUP_NONE)
|
||||
{
|
||||
sprintf(backup_path, "%s%s", dir_save, name);
|
||||
// if (backup_type != BACKUP_NONE)
|
||||
// {
|
||||
// sprintf(backup_path, "%s%s", dir_save, name);
|
||||
|
||||
FILE_OPEN(backup_file, backup_path, WRITE);
|
||||
// FILE_OPEN(backup_file, backup_path, WRITE);
|
||||
|
||||
if (FILE_CHECK_VALID(backup_file))
|
||||
{
|
||||
switch (backup_type)
|
||||
{
|
||||
case BACKUP_SRAM:
|
||||
backup_size = sram_size;
|
||||
break;
|
||||
// if (FILE_CHECK_VALID(backup_file))
|
||||
// {
|
||||
// switch (backup_type)
|
||||
// {
|
||||
// case BACKUP_SRAM:
|
||||
// backup_size = sram_size;
|
||||
// break;
|
||||
|
||||
case BACKUP_FLASH:
|
||||
backup_size = flash_size;
|
||||
break;
|
||||
// case BACKUP_FLASH:
|
||||
// backup_size = flash_size;
|
||||
// break;
|
||||
|
||||
case BACKUP_EEPROM:
|
||||
backup_size = eeprom_size;
|
||||
break;
|
||||
// case BACKUP_EEPROM:
|
||||
// backup_size = eeprom_size;
|
||||
// break;
|
||||
|
||||
default:
|
||||
case BACKUP_NONE:
|
||||
backup_size = 0x8000;
|
||||
break;
|
||||
}
|
||||
// default:
|
||||
// case BACKUP_NONE:
|
||||
// backup_size = 0x8000;
|
||||
// break;
|
||||
// }
|
||||
|
||||
FILE_WRITE(backup_file, gamepak_backup, backup_size);
|
||||
FILE_CLOSE(backup_file);
|
||||
}
|
||||
// FILE_WRITE(backup_file, gamepak_backup, backup_size);
|
||||
// FILE_CLOSE(backup_file);
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
return backup_size;
|
||||
}
|
||||
// return backup_size;
|
||||
//}
|
||||
|
||||
static char *skip_spaces(char *line_ptr)
|
||||
{
|
||||
@@ -3240,31 +3244,16 @@ static s32 load_gamepak_raw(const char *name)
|
||||
|
||||
s32 load_gamepak(const char *name)
|
||||
{
|
||||
char *dot_position = strrchr(name, '.');
|
||||
|
||||
s32 file_size = -1;
|
||||
gamepak_file_large = -1;
|
||||
|
||||
print_string(MSG[MSG_LOADING_ROM], X_POS_CENTER, 100, COLOR15_WHITE, BG_NO_FILL);
|
||||
info_msg("Now Loading...");
|
||||
|
||||
print_string(MSG[MSG_LOADING_ROM], X_POS_CENTER, 100, COLOR15_WHITE, BG_NO_FILL);
|
||||
|
||||
|
||||
if (!strcasecmp(dot_position, ".zip") || !strcasecmp(dot_position, ".gbz"))
|
||||
{
|
||||
file_size = load_file_zip(name);
|
||||
}
|
||||
else
|
||||
|
||||
if (!strcasecmp(dot_position, ".gba") || !strcasecmp(dot_position, ".agb") || !strcasecmp(dot_position, ".bin"))
|
||||
{
|
||||
file_size = load_gamepak_raw(name);
|
||||
|
||||
print_string(MSG[MSG_SEARCHING_BACKUP_ID], X_POS_CENTER, 148, COLOR15_WHITE, BG_NO_FILL);
|
||||
}
|
||||
file_size = load_gamepak_raw(name);
|
||||
|
||||
if (file_size > 0)
|
||||
{
|
||||
info_msg("Searching BACKUP ID");
|
||||
gamepak_size = (file_size + 0x7FFF) & ~0x7FFF;
|
||||
|
||||
char *p = strrchr(name, '/');
|
||||
@@ -3291,7 +3280,6 @@ s32 load_gamepak(const char *name)
|
||||
load_backup(backup_filename);
|
||||
}
|
||||
|
||||
|
||||
return file_size;
|
||||
}
|
||||
|
||||
@@ -3427,13 +3415,13 @@ s32 load_bios(char *name)
|
||||
FILE_##type(savestate_file, io_registers, 0x400); \
|
||||
} \
|
||||
|
||||
static void memory_read_savestate(SceUID savestate_file)
|
||||
{
|
||||
MEMORY_SAVESTATE_BODY(READ);
|
||||
}
|
||||
//static void memory_read_savestate(SceUID savestate_file)
|
||||
//{
|
||||
// MEMORY_SAVESTATE_BODY(READ);
|
||||
//}
|
||||
|
||||
static void memory_write_mem_savestate(SceUID savestate_file)
|
||||
{
|
||||
MEMORY_SAVESTATE_BODY(WRITE_MEM);
|
||||
}
|
||||
//static void memory_write_mem_savestate(SceUID savestate_file)
|
||||
//{
|
||||
// MEMORY_SAVESTATE_BODY(WRITE_MEM);
|
||||
//}
|
||||
|
||||
@@ -1,506 +0,0 @@
|
||||
/* unofficial gameplaySP kai
|
||||
*
|
||||
* Copyright (C) 2006 Exophase <exophase@gmail.com>
|
||||
* Copyright (C) 2007 takka <takka@tfact.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
const char *message[MSG_END] =
|
||||
{
|
||||
// MSG_BROWSER_HELP
|
||||
"○:Select ×:Menu � :" FONT_UP_DIRECTORY,
|
||||
|
||||
// MSG_MENU_DATE_FMT_0
|
||||
"%4d/%2d/%2d %-3s %2d:%02d",
|
||||
|
||||
// MSG_MENU_DATE_FMT_1
|
||||
"%2d/%2d/%4d %-3s %2d:%02d",
|
||||
|
||||
// MSG_MAIN_MENU_TITLE
|
||||
"Menu",
|
||||
|
||||
// MSG_MAIN_MENU_0
|
||||
"Load state : SLOT %d",
|
||||
|
||||
// MSG_MAIN_MENU_1
|
||||
"Save state : SLOT %d",
|
||||
|
||||
// MSG_MAIN_MENU_2
|
||||
"Savestate details " FONT_R_TRIGGER,
|
||||
|
||||
// MSG_MAIN_MENU_3
|
||||
"Screen capture : %s",
|
||||
|
||||
// MSG_MAIN_MENU_4
|
||||
"Emulator options",
|
||||
|
||||
// MSG_MAIN_MENU_5
|
||||
"Gamepad config",
|
||||
|
||||
// MSG_MAIN_MENU_6
|
||||
"Analog stick config",
|
||||
|
||||
// MSG_MAIN_MENU_7
|
||||
"Load game " FONT_L_TRIGGER,
|
||||
|
||||
// MSG_MAIN_MENU_8
|
||||
"Reset",
|
||||
|
||||
// MSG_MAIN_MENU_9
|
||||
"Return to game",
|
||||
|
||||
// MSG_MAIN_MENU_10
|
||||
"Sleep",
|
||||
|
||||
// MSG_MAIN_MENU_11
|
||||
"Exit TempGBA",
|
||||
|
||||
// MSG_MAIN_MENU_HELP_0
|
||||
"○:Load " FONT_CURSOR_LEFT FONT_CURSOR_RIGHT ":Select slot",
|
||||
|
||||
// MSG_MAIN_MENU_HELP_1
|
||||
"○:Save " FONT_CURSOR_LEFT FONT_CURSOR_RIGHT ":Select slot",
|
||||
|
||||
// MSG_MAIN_MENU_HELP_2
|
||||
"○:Sub menu " FONT_R_TRIGGER ":Shortcut key",
|
||||
|
||||
// MSG_MAIN_MENU_HELP_3
|
||||
"○:Save Image " FONT_CURSOR_LEFT FONT_CURSOR_RIGHT ":Select image format",
|
||||
|
||||
// MSG_MAIN_MENU_HELP_4
|
||||
"○:Sub menu",
|
||||
|
||||
// MSG_MAIN_MENU_HELP_5
|
||||
"○:Sub menu",
|
||||
|
||||
// MSG_MAIN_MENU_HELP_6
|
||||
"○:Sub menu",
|
||||
|
||||
// MSG_MAIN_MENU_HELP_7
|
||||
"○:File browser " FONT_L_TRIGGER ":Shortcut key",
|
||||
|
||||
// MSG_MAIN_MENU_HELP_8
|
||||
"○:Reset game",
|
||||
|
||||
// MSG_MAIN_MENU_HELP_9
|
||||
"○:Return to game",
|
||||
|
||||
// MSG_MAIN_MENU_HELP_10
|
||||
"○:Sleep mode",
|
||||
|
||||
// MSG_MAIN_MENU_HELP_11
|
||||
"○:Exit",
|
||||
|
||||
// MSG_OPTION_MENU_TITLE
|
||||
"Emulator options",
|
||||
|
||||
// MSG_OPTION_MENU_0
|
||||
"Display mode : %s",
|
||||
|
||||
// MSG_OPTION_MENU_1
|
||||
"Magnification : %d%%",
|
||||
|
||||
// MSG_OPTION_MENU_2
|
||||
"Bilinear filter : %s",
|
||||
|
||||
// MSG_OPTION_MENU_3
|
||||
"Frameskip type : %s",
|
||||
|
||||
// MSG_OPTION_MENU_4
|
||||
"Frameskip value : %d",
|
||||
|
||||
// MSG_OPTION_MENU_5
|
||||
"CPU clock freq : %s",
|
||||
|
||||
// MSG_OPTION_MENU_6
|
||||
"Sound volume : %s",
|
||||
|
||||
// MSG_OPTION_MENU_7
|
||||
"Stack optimize : %s",
|
||||
|
||||
// MSG_OPTION_MENU_8
|
||||
"Boot from BIOS : %s",
|
||||
|
||||
// MSG_OPTION_MENU_9
|
||||
"Update backup : %s",
|
||||
|
||||
// MSG_OPTION_MENU_10
|
||||
"Language : %s",
|
||||
|
||||
// MSG_OPTION_MENU_11
|
||||
"Back",
|
||||
|
||||
// MSG_OPTION_MENU_HELP_0
|
||||
FONT_CURSOR_LEFT FONT_CURSOR_RIGHT ":Select all games",
|
||||
|
||||
// MSG_OPTION_MENU_HELP_1
|
||||
FONT_CURSOR_LEFT FONT_CURSOR_RIGHT ":Select all games",
|
||||
|
||||
// MSG_OPTION_MENU_HELP_2
|
||||
FONT_CURSOR_LEFT FONT_CURSOR_RIGHT ":Select all games",
|
||||
|
||||
// MSG_OPTION_MENU_HELP_3
|
||||
FONT_CURSOR_LEFT FONT_CURSOR_RIGHT ":Select each games",
|
||||
|
||||
// MSG_OPTION_MENU_HELP_4
|
||||
FONT_CURSOR_LEFT FONT_CURSOR_RIGHT ":Select each games",
|
||||
|
||||
// MSG_OPTION_MENU_HELP_5
|
||||
FONT_CURSOR_LEFT FONT_CURSOR_RIGHT ":Select each games",
|
||||
|
||||
// MSG_OPTION_MENU_HELP_6
|
||||
FONT_CURSOR_LEFT FONT_CURSOR_RIGHT ":Select all games",
|
||||
|
||||
// MSG_OPTION_MENU_HELP_7
|
||||
FONT_CURSOR_LEFT FONT_CURSOR_RIGHT ":Select all games",
|
||||
|
||||
// MSG_OPTION_MENU_HELP_8
|
||||
FONT_CURSOR_LEFT FONT_CURSOR_RIGHT ":Select all games",
|
||||
|
||||
// MSG_OPTION_MENU_HELP_9
|
||||
FONT_CURSOR_LEFT FONT_CURSOR_RIGHT ":Select all games",
|
||||
|
||||
// MSG_OPTION_MENU_HELP_10
|
||||
FONT_CURSOR_LEFT FONT_CURSOR_RIGHT ":Select all games",
|
||||
|
||||
// MSG_OPTION_MENU_HELP_11
|
||||
"○:Main menu",
|
||||
|
||||
// MSG_STATE_MENU_DATE_FMT_0
|
||||
"%4d/%2d/%2d %-3s %2d:%02d:%02d",
|
||||
|
||||
// MSG_STATE_MENU_DATE_FMT_1
|
||||
"%2d/%2d/%4d %-3s %2d:%02d:%02d",
|
||||
|
||||
// MSG_STATE_MENU_DATE_NONE_0
|
||||
"----/--/-- --- --:--:--",
|
||||
|
||||
// MSG_STATE_MENU_DATE_NONE_1
|
||||
"--/--/---- --- --:--:--",
|
||||
|
||||
// MSG_STATE_MENU_STATE_NONE
|
||||
"No data in this slot",
|
||||
|
||||
// MSG_STATE_MENU_TITLE
|
||||
"Savestate",
|
||||
|
||||
// MSG_STATE_MENU_0
|
||||
"",
|
||||
|
||||
// MSG_STATE_MENU_1
|
||||
"Load state from file",
|
||||
|
||||
// MSG_STATE_MENU_2
|
||||
"Back",
|
||||
|
||||
// MSG_STATE_MENU_HELP_0
|
||||
"○:Execute " FONT_CURSOR_LEFT FONT_CURSOR_RIGHT ":Select",
|
||||
|
||||
// MSG_STATE_MENU_HELP_1
|
||||
"○:File browser",
|
||||
|
||||
// MSG_STATE_MENU_HELP_2
|
||||
"○:Main menu",
|
||||
|
||||
// MSG_PAD_MENU_TITLE
|
||||
"Gamepad config",
|
||||
|
||||
// MSG_PAD_MENU_0
|
||||
"↑ : %s",
|
||||
|
||||
// MSG_PAD_MENU_1
|
||||
"↓ : %s",
|
||||
|
||||
// MSG_PAD_MENU_2
|
||||
"← : %s",
|
||||
|
||||
// MSG_PAD_MENU_3
|
||||
"→ : %s",
|
||||
|
||||
// MSG_PAD_MENU_4
|
||||
"○ : %s",
|
||||
|
||||
// MSG_PAD_MENU_5
|
||||
"× : %s",
|
||||
|
||||
// MSG_PAD_MENU_6
|
||||
"� : %s",
|
||||
|
||||
// MSG_PAD_MENU_7
|
||||
"△ : %s",
|
||||
|
||||
// MSG_PAD_MENU_8
|
||||
FONT_L_TRIGGER " : %s",
|
||||
|
||||
// MSG_PAD_MENU_9
|
||||
FONT_R_TRIGGER " : %s",
|
||||
|
||||
// MSG_PAD_MENU_10
|
||||
"START : %s",
|
||||
|
||||
// MSG_PAD_MENU_11
|
||||
"SELECT : %s",
|
||||
|
||||
// MSG_PAD_MENU_12
|
||||
"Back",
|
||||
|
||||
// MSG_PAD_MENU_HELP_0
|
||||
FONT_CURSOR_LEFT FONT_CURSOR_RIGHT ":Select",
|
||||
|
||||
// MSG_PAD_MENU_HELP_1
|
||||
"○:Main menu",
|
||||
|
||||
//PADの設定 コンフィグ
|
||||
|
||||
// MSG_PAD_MENU_CFG_0
|
||||
"↑",
|
||||
|
||||
// MSG_PAD_MENU_CFG_1
|
||||
"↓",
|
||||
|
||||
// MSG_PAD_MENU_CFG_2
|
||||
"←",
|
||||
|
||||
// MSG_PAD_MENU_CFG_3
|
||||
"→",
|
||||
|
||||
// MSG_PAD_MENU_CFG_4
|
||||
"A",
|
||||
|
||||
// MSG_PAD_MENU_CFG_5
|
||||
"B",
|
||||
|
||||
// MSG_PAD_MENU_CFG_6
|
||||
"L",
|
||||
|
||||
// MSG_PAD_MENU_CFG_7
|
||||
"R",
|
||||
|
||||
// MSG_PAD_MENU_CFG_8
|
||||
"START",
|
||||
|
||||
// MSG_PAD_MENU_CFG_9
|
||||
"SELECT",
|
||||
|
||||
// MSG_PAD_MENU_CFG_10
|
||||
"menu",
|
||||
|
||||
// MSG_PAD_MENU_CFG_11
|
||||
"fast forward",
|
||||
|
||||
// MSG_PAD_MENU_CFG_12
|
||||
"load state",
|
||||
|
||||
// MSG_PAD_MENU_CFG_13
|
||||
"save state",
|
||||
|
||||
// MSG_PAD_MENU_CFG_14
|
||||
"RAPID FIRE A",
|
||||
|
||||
// MSG_PAD_MENU_CFG_15
|
||||
"RAPID FIRE B",
|
||||
|
||||
// MSG_PAD_MENU_CFG_16
|
||||
"RAPID FIRE L",
|
||||
|
||||
// MSG_PAD_MENU_CFG_17
|
||||
"RAPID FIRE R",
|
||||
|
||||
// MSG_PAD_MENU_CFG_18
|
||||
"show fps",
|
||||
|
||||
// MSG_PAD_MENU_CFG_19
|
||||
"none",
|
||||
|
||||
// MSG_A_PAD_MENU_TITLE
|
||||
"Analog stick config",
|
||||
|
||||
// MSG_A_PAD_MENU_0
|
||||
"Analog ↑ : %s",
|
||||
|
||||
// MSG_A_PAD_MENU_1
|
||||
"Analog ↓ : %s",
|
||||
|
||||
// MSG_A_PAD_MENU_2
|
||||
"Analog ← : %s",
|
||||
|
||||
// MSG_A_PAD_MENU_3
|
||||
"Analog → : %s",
|
||||
|
||||
// MSG_A_PAD_MENU_4
|
||||
"Enable analog input : %s",
|
||||
|
||||
// MSG_A_PAD_MENU_5
|
||||
"Analog sensitivity : %d",
|
||||
|
||||
// MSG_A_PAD_MENU_6
|
||||
"Back",
|
||||
|
||||
// MSG_A_PAD_MENU_HELP_0
|
||||
FONT_CURSOR_LEFT FONT_CURSOR_RIGHT ":Select",
|
||||
|
||||
// MSG_A_PAD_MENU_HELP_1
|
||||
FONT_CURSOR_LEFT FONT_CURSOR_RIGHT ":Select",
|
||||
|
||||
// MSG_A_PAD_MENU_HELP_2
|
||||
"○:Main menu",
|
||||
|
||||
// MSG_NON_LOAD_GAME
|
||||
"Game is not loaded",
|
||||
|
||||
// MSG_DAYW_0
|
||||
"SUN",
|
||||
|
||||
// MSG_DAYW_1
|
||||
"MON",
|
||||
|
||||
// MSG_DAYW_2
|
||||
"TUE",
|
||||
|
||||
// MSG_DAYW_3
|
||||
"WED",
|
||||
|
||||
// MSG_DAYW_4
|
||||
"THU",
|
||||
|
||||
// MSG_DAYW_5
|
||||
"FRI",
|
||||
|
||||
// MSG_DAYW_6
|
||||
"SAT",
|
||||
|
||||
// MSG_YES
|
||||
"YES",
|
||||
|
||||
// MSG_NO
|
||||
"NO",
|
||||
|
||||
// MSG_ON
|
||||
"ON",
|
||||
|
||||
// MSG_OFF
|
||||
"OFF",
|
||||
|
||||
// MSG_ENABLED
|
||||
"ENABLE",
|
||||
|
||||
// MSG_DISABLED
|
||||
"DISABLED",
|
||||
|
||||
// MSG_AUTO
|
||||
"AUTO",
|
||||
|
||||
// MSG_MANUAL
|
||||
"MANUAL",
|
||||
|
||||
// MSG_EXITONLY
|
||||
"Exit Only",
|
||||
|
||||
// MSG_LOAD
|
||||
"LOAD",
|
||||
|
||||
// MSG_SAVE
|
||||
"SAVE",
|
||||
|
||||
// MSG_SCN_SCALED_NONE
|
||||
"100% GU",
|
||||
|
||||
// MSG_SCN_SCALED_X15_GU
|
||||
"150% GU",
|
||||
|
||||
// MSG_SCN_SCALED_X15_SW
|
||||
"150% SW",
|
||||
|
||||
// MSG_SCN_SCALED_USER
|
||||
"USER GU",
|
||||
|
||||
// MSG_LANG_JAPANESE
|
||||
"Japanese",
|
||||
|
||||
// MSG_LANG_ENGLISH
|
||||
"English",
|
||||
|
||||
// MSG_SS_DATE_FMT_0
|
||||
"%04d_%02d_%02d_%s%02d_%02d_%02d_%03d",
|
||||
|
||||
// MSG_SS_DATE_FMT_1
|
||||
"%02d_%02d_%04d_%s%02d_%02d_%02d_%03d",
|
||||
|
||||
// MSG_ERR_SET_DIR_0
|
||||
"ERROR [%s] Specified directory is invalid.",
|
||||
|
||||
// MSG_ERR_SET_DIR_1
|
||||
"ERROR [%s] Not specified.",
|
||||
|
||||
// MSG_ERR_SET_DIR_2
|
||||
"The error occurred. It's set as the following directories.\n%s",
|
||||
|
||||
// png.c
|
||||
// MSG_ERR_SS_PNG_0
|
||||
"Could not allocate memory for PNG.",
|
||||
|
||||
// MSG_ERR_SS_PNG_1
|
||||
"Could not enecode PNG image.",
|
||||
|
||||
// memory.c
|
||||
// MSG_LOADING_ROM
|
||||
"Now Loading...",
|
||||
|
||||
// MSG_SEARCHING_BACKUP_ID
|
||||
"Searching BACKUP ID",
|
||||
|
||||
// main.c
|
||||
// MSG_GBA_SLEEP_MODE
|
||||
"SLEEP MODE",
|
||||
|
||||
// MSG_ERR_LOAD_DIR_INI
|
||||
"Could not load dir.ini file.\nEverything is set as the following directory.\n%s",
|
||||
|
||||
// MSG_ERR_BIOS_NONE
|
||||
"Could not load BIOS image file.",
|
||||
|
||||
// MSG_ERR_LOAD_GAMEPACK
|
||||
"Could not load the game file.",
|
||||
|
||||
// MSG_ERR_OPEN_GAMEPACK
|
||||
"Could not open the game file.",
|
||||
|
||||
// MSG_ERR_START_CALLBACK_THREAD
|
||||
"Could not start the callback thread.",
|
||||
|
||||
// sound.c
|
||||
// MSG_ERR_RESERVE_AUDIO_CHANNEL
|
||||
"Could not reserve audio channel.",
|
||||
|
||||
// MSG_ERR_START_SOUND_THREAD
|
||||
"Could not start the sound thread.",
|
||||
|
||||
// MSG_ERR_MALLOC
|
||||
"Could not allocate memory.",
|
||||
|
||||
// MSG_ERR_CONT
|
||||
"Press any button to continue.",
|
||||
|
||||
// MSG_ERR_QUIT
|
||||
"Press any button to exit.",
|
||||
|
||||
// MSG_BLANK
|
||||
""
|
||||
|
||||
};
|
||||
|
||||
@@ -1,255 +0,0 @@
|
||||
/* unofficial gameplaySP kai
|
||||
*
|
||||
* Copyright (C) 2006 Exophase <exophase@gmail.com>
|
||||
* Copyright (C) 2007 takka <takka@tfact.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MESSAGE_H
|
||||
#define MESSAGE_H
|
||||
|
||||
|
||||
#define BG_NO_FILL (-1)
|
||||
#define FONT_BATTERY0
|
||||
#define FONT_BATTERY1
|
||||
#define FONT_BATTERY2
|
||||
#define FONT_BATTERY3
|
||||
#define FONT_GBA_ICON
|
||||
|
||||
#define FONT_KEY_ICON
|
||||
#define FONT_R_TRIGGER
|
||||
#define FONT_L_TRIGGER
|
||||
#define FONT_CURSOR_RIGHT
|
||||
#define FONT_CURSOR_LEFT
|
||||
#define FONT_CURSOR_UP
|
||||
#define FONT_CURSOR_DOWN
|
||||
#define FONT_CURSOR_RIGHT_FILL
|
||||
#define FONT_CURSOR_LEFT_FILL
|
||||
#define FONT_CURSOR_UP_FILL
|
||||
#define FONT_CURSOR_DOWN_FILL
|
||||
#define FONT_UP_DIRECTORY
|
||||
|
||||
#define MSG message
|
||||
|
||||
enum MESSAGE_ITEM
|
||||
{
|
||||
MSG_BROWSER_HELP,
|
||||
|
||||
MSG_MENU_DATE_FMT_0,
|
||||
MSG_MENU_DATE_FMT_1,
|
||||
|
||||
MSG_MAIN_MENU_TITLE,
|
||||
|
||||
MSG_MAIN_MENU_0,
|
||||
MSG_MAIN_MENU_1,
|
||||
MSG_MAIN_MENU_2,
|
||||
MSG_MAIN_MENU_3,
|
||||
MSG_MAIN_MENU_4,
|
||||
MSG_MAIN_MENU_5,
|
||||
MSG_MAIN_MENU_6,
|
||||
MSG_MAIN_MENU_7,
|
||||
MSG_MAIN_MENU_8,
|
||||
MSG_MAIN_MENU_9,
|
||||
MSG_MAIN_MENU_10,
|
||||
MSG_MAIN_MENU_11,
|
||||
|
||||
MSG_MAIN_MENU_HELP_0,
|
||||
MSG_MAIN_MENU_HELP_1,
|
||||
MSG_MAIN_MENU_HELP_2,
|
||||
MSG_MAIN_MENU_HELP_3,
|
||||
MSG_MAIN_MENU_HELP_4,
|
||||
MSG_MAIN_MENU_HELP_5,
|
||||
MSG_MAIN_MENU_HELP_6,
|
||||
MSG_MAIN_MENU_HELP_7,
|
||||
MSG_MAIN_MENU_HELP_8,
|
||||
MSG_MAIN_MENU_HELP_9,
|
||||
MSG_MAIN_MENU_HELP_10,
|
||||
MSG_MAIN_MENU_HELP_11,
|
||||
|
||||
MSG_OPTION_MENU_TITLE,
|
||||
|
||||
MSG_OPTION_MENU_0,
|
||||
MSG_OPTION_MENU_1,
|
||||
MSG_OPTION_MENU_2,
|
||||
MSG_OPTION_MENU_3,
|
||||
MSG_OPTION_MENU_4,
|
||||
MSG_OPTION_MENU_5,
|
||||
MSG_OPTION_MENU_6,
|
||||
MSG_OPTION_MENU_7,
|
||||
MSG_OPTION_MENU_8,
|
||||
MSG_OPTION_MENU_9,
|
||||
MSG_OPTION_MENU_10,
|
||||
MSG_OPTION_MENU_11,
|
||||
|
||||
MSG_OPTION_MENU_HELP_0,
|
||||
MSG_OPTION_MENU_HELP_1,
|
||||
MSG_OPTION_MENU_HELP_2,
|
||||
MSG_OPTION_MENU_HELP_3,
|
||||
MSG_OPTION_MENU_HELP_4,
|
||||
MSG_OPTION_MENU_HELP_5,
|
||||
MSG_OPTION_MENU_HELP_6,
|
||||
MSG_OPTION_MENU_HELP_7,
|
||||
MSG_OPTION_MENU_HELP_8,
|
||||
MSG_OPTION_MENU_HELP_9,
|
||||
MSG_OPTION_MENU_HELP_10,
|
||||
MSG_OPTION_MENU_HELP_11,
|
||||
|
||||
MSG_STATE_MENU_DATE_FMT_0,
|
||||
MSG_STATE_MENU_DATE_FMT_1,
|
||||
MSG_STATE_MENU_DATE_NONE_0,
|
||||
MSG_STATE_MENU_DATE_NONE_1,
|
||||
|
||||
MSG_STATE_MENU_STATE_NONE,
|
||||
|
||||
MSG_STATE_MENU_TITLE,
|
||||
|
||||
MSG_STATE_MENU_0,
|
||||
MSG_STATE_MENU_1,
|
||||
MSG_STATE_MENU_2,
|
||||
|
||||
MSG_STATE_MENU_HELP_0,
|
||||
MSG_STATE_MENU_HELP_1,
|
||||
MSG_STATE_MENU_HELP_2,
|
||||
|
||||
MSG_PAD_MENU_TITLE,
|
||||
|
||||
MSG_PAD_MENU_0,
|
||||
MSG_PAD_MENU_1,
|
||||
MSG_PAD_MENU_2,
|
||||
MSG_PAD_MENU_3,
|
||||
MSG_PAD_MENU_4,
|
||||
MSG_PAD_MENU_5,
|
||||
MSG_PAD_MENU_6,
|
||||
MSG_PAD_MENU_7,
|
||||
MSG_PAD_MENU_8,
|
||||
MSG_PAD_MENU_9,
|
||||
MSG_PAD_MENU_10,
|
||||
MSG_PAD_MENU_11,
|
||||
MSG_PAD_MENU_12,
|
||||
|
||||
MSG_PAD_MENU_HELP_0,
|
||||
MSG_PAD_MENU_HELP_1,
|
||||
|
||||
MSG_PAD_MENU_CFG_0,
|
||||
MSG_PAD_MENU_CFG_1,
|
||||
MSG_PAD_MENU_CFG_2,
|
||||
MSG_PAD_MENU_CFG_3,
|
||||
MSG_PAD_MENU_CFG_4,
|
||||
MSG_PAD_MENU_CFG_5,
|
||||
MSG_PAD_MENU_CFG_6,
|
||||
MSG_PAD_MENU_CFG_7,
|
||||
MSG_PAD_MENU_CFG_8,
|
||||
MSG_PAD_MENU_CFG_9,
|
||||
MSG_PAD_MENU_CFG_10,
|
||||
MSG_PAD_MENU_CFG_11,
|
||||
MSG_PAD_MENU_CFG_12,
|
||||
MSG_PAD_MENU_CFG_13,
|
||||
MSG_PAD_MENU_CFG_14,
|
||||
MSG_PAD_MENU_CFG_15,
|
||||
MSG_PAD_MENU_CFG_16,
|
||||
MSG_PAD_MENU_CFG_17,
|
||||
MSG_PAD_MENU_CFG_18,
|
||||
MSG_PAD_MENU_CFG_19,
|
||||
|
||||
MSG_A_PAD_MENU_TITLE,
|
||||
|
||||
MSG_A_PAD_MENU_0,
|
||||
MSG_A_PAD_MENU_1,
|
||||
MSG_A_PAD_MENU_2,
|
||||
MSG_A_PAD_MENU_3,
|
||||
MSG_A_PAD_MENU_4,
|
||||
MSG_A_PAD_MENU_5,
|
||||
MSG_A_PAD_MENU_6,
|
||||
|
||||
MSG_A_PAD_MENU_HELP_0,
|
||||
MSG_A_PAD_MENU_HELP_1,
|
||||
MSG_A_PAD_MENU_HELP_2,
|
||||
|
||||
MSG_NON_LOAD_GAME,
|
||||
|
||||
MSG_DAYW_0,
|
||||
MSG_DAYW_1,
|
||||
MSG_DAYW_2,
|
||||
MSG_DAYW_3,
|
||||
MSG_DAYW_4,
|
||||
MSG_DAYW_5,
|
||||
MSG_DAYW_6,
|
||||
|
||||
MSG_YES,
|
||||
MSG_NO,
|
||||
|
||||
MSG_ON,
|
||||
MSG_OFF,
|
||||
|
||||
MSG_ENABLED,
|
||||
MSG_DISABLED,
|
||||
|
||||
MSG_AUTO,
|
||||
MSG_MANUAL,
|
||||
|
||||
MSG_EXITONLY,
|
||||
|
||||
MSG_LOAD,
|
||||
MSG_SAVE,
|
||||
|
||||
MSG_SCN_SCALED_NONE,
|
||||
MSG_SCN_SCALED_X15_GU,
|
||||
MSG_SCN_SCALED_X15_SW,
|
||||
MSG_SCN_SCALED_USER,
|
||||
|
||||
MSG_LANG_JAPANESE,
|
||||
MSG_LANG_ENGLISH,
|
||||
|
||||
MSG_SS_DATE_FMT_0,
|
||||
MSG_SS_DATE_FMT_1,
|
||||
|
||||
MSG_ERR_SET_DIR_0,
|
||||
MSG_ERR_SET_DIR_1,
|
||||
MSG_ERR_SET_DIR_2,
|
||||
|
||||
MSG_ERR_SS_PNG_0,
|
||||
MSG_ERR_SS_PNG_1,
|
||||
|
||||
MSG_LOADING_ROM,
|
||||
MSG_SEARCHING_BACKUP_ID,
|
||||
|
||||
MSG_GBA_SLEEP_MODE,
|
||||
|
||||
MSG_ERR_LOAD_DIR_INI,
|
||||
|
||||
MSG_ERR_BIOS_NONE,
|
||||
|
||||
MSG_ERR_LOAD_GAMEPACK,
|
||||
MSG_ERR_OPEN_GAMEPACK,
|
||||
|
||||
MSG_ERR_START_CALLBACK_THREAD,
|
||||
|
||||
MSG_ERR_RESERVE_AUDIO_CHANNEL,
|
||||
MSG_ERR_START_SOUND_THREAD,
|
||||
|
||||
MSG_ERR_MALLOC,
|
||||
|
||||
MSG_ERR_CONT,
|
||||
MSG_ERR_QUIT,
|
||||
|
||||
MSG_BLANK,
|
||||
|
||||
MSG_END
|
||||
};
|
||||
|
||||
extern const char *message[MSG_END];
|
||||
|
||||
#endif /* MESSAGE_H */
|
||||
@@ -3160,19 +3160,6 @@ void clear_texture(u16 color)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void print_string(const char *str, s16 x, u16 y, u16 fg_color, s16 bg_color)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
void print_string_ext(const char *str, s16 x, u16 y, u16 fg_color, s16 bg_color, void *_dest_ptr, u16 pitch)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define VIDEO_SAVESTATE_BODY(type) \
|
||||
FILE_##type##_ARRAY(savestate_file, affine_reference_x); \
|
||||
FILE_##type##_ARRAY(savestate_file, affine_reference_y); \
|
||||
|
||||
@@ -68,9 +68,6 @@
|
||||
|
||||
void update_scanline(void);
|
||||
|
||||
void print_string(const char *str, s16 x, u16 y, u16 fg_color, s16 bg_color);
|
||||
void print_string_ext(const char *str, s16 x, u16 y, u16 fg_color, s16 bg_color, void *_dest_ptr, u16 pitch);
|
||||
|
||||
void clear_texture(u16 color);
|
||||
|
||||
void blit_to_screen(u16 *src, u16 w, u16 h, u16 dest_x, u16 dest_y);
|
||||
|
||||
@@ -1,166 +0,0 @@
|
||||
/* unofficial gameplaySP kai
|
||||
*
|
||||
* Copyright (C) 2006 Exophase <exophase@gmail.com>
|
||||
* Copyright (C) 2006 SiberianSTAR
|
||||
* Copyright (C) 2007 takka <takka@tfact.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#define ZIP_BUFFER_SIZE (128 * 1024)
|
||||
|
||||
struct SZIPFileDataDescriptor
|
||||
{
|
||||
s32 CRC32;
|
||||
s32 CompressedSize;
|
||||
s32 UncompressedSize;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct SZIPFileHeader
|
||||
{
|
||||
char Sig[4];
|
||||
s16 VersionToExtract;
|
||||
s16 GeneralBitFlag;
|
||||
s16 CompressionMethod;
|
||||
s16 LastModFileTime;
|
||||
s16 LastModFileDate;
|
||||
struct SZIPFileDataDescriptor DataDescriptor;
|
||||
s16 FilenameLength;
|
||||
s16 ExtraFieldLength;
|
||||
} __attribute__((packed));
|
||||
|
||||
void draw_progress(u32 output_size, u32 total_size);
|
||||
|
||||
|
||||
s32 load_file_zip(const char *filename)
|
||||
{
|
||||
SceUID fd;
|
||||
struct SZIPFileHeader data;
|
||||
char tmp[MAX_FILE];
|
||||
s32 retval = -1;
|
||||
u8 *buffer = NULL;
|
||||
u8 *cbuffer = NULL;
|
||||
char *ext;
|
||||
|
||||
FILE_OPEN(fd, filename, READ);
|
||||
|
||||
if (!FILE_CHECK_VALID(fd))
|
||||
return -1;
|
||||
|
||||
FILE_READ(fd, &data, sizeof(struct SZIPFileHeader));
|
||||
|
||||
if ((data.Sig[0] != 0x50) || (data.Sig[1] != 0x4B) || (data.Sig[2] != 0x03) || (data.Sig[3] != 0x04))
|
||||
{
|
||||
goto outcode;
|
||||
}
|
||||
|
||||
FILE_READ(fd, tmp, data.FilenameLength);
|
||||
tmp[data.FilenameLength] = 0; // end string
|
||||
|
||||
if (data.ExtraFieldLength != 0)
|
||||
{
|
||||
FILE_SEEK(fd, data.ExtraFieldLength, SEEK_CUR);
|
||||
}
|
||||
|
||||
if ((data.GeneralBitFlag & 0x0008) != 0)
|
||||
{
|
||||
FILE_READ(fd, &data.DataDescriptor, sizeof(struct SZIPFileDataDescriptor));
|
||||
}
|
||||
|
||||
// file is too big
|
||||
if ((u32)data.DataDescriptor.UncompressedSize > gamepak_ram_buffer_size)
|
||||
{
|
||||
retval = -2;
|
||||
goto outcode;
|
||||
}
|
||||
|
||||
ext = strrchr(tmp, '.') + 1;
|
||||
|
||||
if ((strcasecmp(ext, "bin") == 0) || (strcasecmp(ext, "gba") == 0) || (strcasecmp(ext, "agb") == 0))
|
||||
{
|
||||
buffer = gamepak_rom;
|
||||
|
||||
// ok, found
|
||||
switch (data.CompressionMethod)
|
||||
{
|
||||
case 0: // Z_NO_COMPRESSION
|
||||
retval = (u32)data.DataDescriptor.UncompressedSize;
|
||||
FILE_READ(fd, buffer, retval);
|
||||
break;
|
||||
|
||||
case 8: // Z_DEFLATED
|
||||
{
|
||||
z_stream stream;
|
||||
s32 err;
|
||||
|
||||
if ((cbuffer = (u8 *)malloc(ZIP_BUFFER_SIZE)) == NULL)
|
||||
break;
|
||||
memset(cbuffer, 0, ZIP_BUFFER_SIZE);
|
||||
|
||||
stream.next_in = (Bytef*)cbuffer;
|
||||
stream.avail_in = (u32)ZIP_BUFFER_SIZE;
|
||||
stream.next_out = (Bytef*)buffer;
|
||||
stream.avail_out = data.DataDescriptor.UncompressedSize;
|
||||
stream.zalloc = (alloc_func)Z_NULL;
|
||||
stream.zfree = (free_func)Z_NULL;
|
||||
stream.opaque = (voidpf)Z_NULL;
|
||||
|
||||
err = inflateInit2(&stream, -MAX_WBITS);
|
||||
|
||||
FILE_READ(fd, cbuffer, ZIP_BUFFER_SIZE);
|
||||
|
||||
if (err == Z_OK)
|
||||
{
|
||||
retval = (u32)data.DataDescriptor.UncompressedSize;
|
||||
|
||||
while (err != Z_STREAM_END)
|
||||
{
|
||||
err = inflate(&stream, Z_SYNC_FLUSH);
|
||||
|
||||
if (err == Z_BUF_ERROR)
|
||||
{
|
||||
stream.avail_in = ZIP_BUFFER_SIZE;
|
||||
stream.next_in = (Bytef*)cbuffer;
|
||||
|
||||
FILE_READ(fd, cbuffer, ZIP_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
draw_progress((u32)stream.total_out, (u32)retval);
|
||||
}
|
||||
|
||||
err = Z_OK;
|
||||
inflateEnd(&stream);
|
||||
}
|
||||
|
||||
free(cbuffer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
outcode:
|
||||
FILE_CLOSE(fd);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void draw_progress(u32 output_size, u32 total_size)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
/* unofficial gameplaySP kai
|
||||
*
|
||||
* Copyright (C) 2006 Exophase <exophase@gmail.com>
|
||||
* Copyright (C) 2007 takka <takka@tfact.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef ZIP_H
|
||||
#define ZIP_H
|
||||
|
||||
|
||||
s32 load_file_zip(const char *filename);
|
||||
|
||||
|
||||
#endif /* ZIP_H */
|
||||
Reference in new issue
Block a user