aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/dsp4emu.cpp7
-rw-r--r--source/nds/bdf_font.c50
-rw-r--r--source/nds/ds2_main.c1
-rw-r--r--source/nds/entry.cpp13
-rw-r--r--source/nds/entry.h15
-rw-r--r--source/nds/gcheat.c4
-rw-r--r--source/nds/gui.c83
-rw-r--r--source/nds/gui.h1
-rw-r--r--source/seta018.cpp4
-rw-r--r--source/snapshot.cpp6
10 files changed, 37 insertions, 147 deletions
diff --git a/source/dsp4emu.cpp b/source/dsp4emu.cpp
index 115b9e4..b36cadb 100644
--- a/source/dsp4emu.cpp
+++ b/source/dsp4emu.cpp
@@ -214,7 +214,6 @@ void DSP4_Op01()
int16 index, lcv;
int16 py_dy=0, px_dx=0;
int16 y_out, x_out;
- int8 envelope = DSP4.parameters[6];// | (DSP4.parameters[7]<<8);
// ignore invalid data
if((uint16) plane == 0x8001) continue;
@@ -425,7 +424,6 @@ void DSP4_Op07()
project_y2 = DSP4_READ_WORD(2);
// ? = DSP4_READ_WORD(4);
project_x2 = DSP4_READ_WORD(6);
- int8 envelope = DSP4.parameters[8];// | (DSP4.parameters[9]<<8);
// ignore invalid data
if((uint16) plane == 0x8001) continue;
@@ -624,8 +622,6 @@ void DSP4_Op08()
// envelope guidelines (one frame only)
int16 envelope1 = DSP4_READ_WORD(0x0a);
int16 envelope2 = DSP4_READ_WORD(0x0c);
- int16 envelope3 = DSP4_READ_WORD(0x0e);
- int16 envelope4 = DSP4_READ_WORD(0x10);
// ignore invalid data
if((uint16) plane == 0x8001) continue;
@@ -679,7 +675,7 @@ void DSP4_Op08()
{
int16 index=0, lcv;
int16 left_inc=0,right_inc=0;
- int16 dx1,dx2,dx3,dx4;
+ int16 dx1=0,dx2=0,dx3,dx4;
// # segments to traverse
segments = abs(y_left - path_y[0]);
@@ -966,7 +962,6 @@ void DSP4_Op0D()
int16 index, lcv;
int16 py_dy=0, px_dx=0;
int16 y_out, x_out;
- int8 envelope = DSP4.parameters[6];// | (DSP4.parameters[7]<<8);
// ignore invalid data
if((uint16) plane == 0x8001) continue;
diff --git a/source/nds/bdf_font.c b/source/nds/bdf_font.c
index 773403a..92b8923 100644
--- a/source/nds/bdf_font.c
+++ b/source/nds/bdf_font.c
@@ -80,35 +80,6 @@ static u32 bitmap_code(unsigned char *code, unsigned char *bitmap)
/*-----------------------------------------------------------------------------
------------------------------------------------------------------------------*/
-static u32 hatoi(char *string)
-{
- char *pt;
- u32 ret, num;
-
- pt= string;
- ret= 0;
- while(*pt)
- {
- num= (((u32)*pt) & 0xFF) - 0x30;
- if(num <= 0x9)
- ret= (ret<<4) | num;
- else if(num <= 0x16)
- {
- if(num >= 0x11)
- ret= (ret<<4) | (num-0x7);
- else
- break;
- }
- else
- break;
- pt++;
- }
-
- return ret;
-}
-
-/*-----------------------------------------------------------------------------
-------------------------------------------------------------------------------*/
/*
* example
*
@@ -908,27 +879,6 @@ char* utf8decode(char *utf8, u16 *ucs)
return utf8;
}
-static u8 utf8_ucs2(const char *utf8, u16 *ucs)
-{
- char *pt = (char*)utf8;
-
- while(*pt !='\0')
- {
- pt = utf8decode(pt, ucs++);
- }
- *ucs = '\0';
- return 0;
-}
-
-static u32 ucslen(const u16 *ucs)
-{
- u32 len = 0;
-
- while(ucs[len] != '\0')
- len++;
- return len;
-}
-
unsigned char* skip_utf8_unit(unsigned char* utf8, unsigned int num)
{
while(num--)
diff --git a/source/nds/ds2_main.c b/source/nds/ds2_main.c
index 7229727..f9b29d5 100644
--- a/source/nds/ds2_main.c
+++ b/source/nds/ds2_main.c
@@ -21,6 +21,7 @@
#include "console.h"
#include "fs_api.h"
#include "ds2io.h"
+#include "ds2_cpu.h"
#include "ds2_timer.h"
#include "ds2_malloc.h"
#include "ds2sound.h"
diff --git a/source/nds/entry.cpp b/source/nds/entry.cpp
index 8672a14..1301ba7 100644
--- a/source/nds/entry.cpp
+++ b/source/nds/entry.cpp
@@ -20,6 +20,7 @@
#include "draw.h"
#include "gui.h"
+#include "entry.h"
#include "ds2sound.h"
void S9xProcessSound (unsigned int);
@@ -413,12 +414,6 @@ void init_sfc_setting(void)
Settings.HBlankStart = (256 * Settings.H_Max) / SNES_HCOUNTER_MAX;
}
-extern "C" {
- int game_load_state(char* file);
- int game_save_state(char* file);
- void S9xAutoSaveSRAM ();
-}
-
void S9xAutoSaveSRAM ()
{
Memory.SaveSRAM (S9xGetFilename (".srm"));
@@ -448,16 +443,12 @@ int game_save_state(char* file)
return flag;
}
-extern "C" void game_restart(void);
-
void game_restart(void)
{
CPU.Flags = 0;
S9xReset ();
}
-extern "C" int load_gamepak(char* file);
-
int load_gamepak(char* file)
{
CPU.Flags = 0;
@@ -640,7 +631,7 @@ void S9xSyncSpeed ()
else if (Settings.SkipFrames == AUTO_FRAMERATE /* && !game_fast_forward */)
{
// frame_time is in getSysTime units: 42.667 microseconds.
- uint32 frame_time = Settings.PAL ? 468 /* = 20.0 ms */ : 391 /* = 16.67 ms */;
+ int32 frame_time = Settings.PAL ? 468 /* = 20.0 ms */ : 391 /* = 16.67 ms */;
if (sync_last > syncnow) // Overflow occurred! (every 50 hrs)
{
// Render this frame regardless, set the
diff --git a/source/nds/entry.h b/source/nds/entry.h
new file mode 100644
index 0000000..a6bd350
--- /dev/null
+++ b/source/nds/entry.h
@@ -0,0 +1,15 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+ int game_load_state(char* file);
+ int game_save_state(char* file);
+ void S9xAutoSaveSRAM ();
+
+ void game_restart(void);
+
+ int load_gamepak(char* file);
+#ifdef __cplusplus
+}
+#endif
+
+const char *S9xGetFilename (const char *ex);
diff --git a/source/nds/gcheat.c b/source/nds/gcheat.c
index 6ab4a84..93d89cc 100644
--- a/source/nds/gcheat.c
+++ b/source/nds/gcheat.c
@@ -59,7 +59,7 @@ int NDSSFCLoadCheatFile(const char* filename)
fclose(fp);
return -2;
}
- *ptr++; // Past the comma
+ ptr++; // Past the comma
if (*ptr && *ptr == '"')
ptr++; // Starting quote of b.
@@ -72,7 +72,7 @@ int NDSSFCLoadCheatFile(const char* filename)
return -2;
}
*ptr = '\0'; // End the codes there
- *ptr++; // Past the comma
+ ptr++; // Past the comma
uint32 i = 0;
description = ptr; // Skip starting " in description
diff --git a/source/nds/gui.c b/source/nds/gui.c
index d28e2a2..f668a5f 100644
--- a/source/nds/gui.c
+++ b/source/nds/gui.c
@@ -25,12 +25,14 @@
#include "port.h"
#include "ds2_types.h"
+#include "ds2_timer.h"
#include "ds2io.h"
#include "ds2_malloc.h"
#include "ds2_cpu.h"
#include "fs_api.h"
#include "key.h"
#include "gui.h"
+#include "entry.h"
#include "draw.h"
#include "message.h"
#include "bitmap.h"
@@ -282,7 +284,6 @@ u32 gamepad_config_menu;
/******************************************************************************
******************************************************************************/
static void get_savestate_filelist(void);
-static FILE* get_savestate_snapshot(char *savestate_filename);
static void get_savestate_filename(u32 slot, char *name_buffer);
static uint8 SavedStateSquareX (u32 slot);
static bool8 SavedStateFileExists (u32 slot);
@@ -620,7 +621,6 @@ static int load_file_list(struct FILE_LIST_INFO *filelist_infop)
unsigned int num_files;
unsigned int num_dirs;
char **wildcards;
- char utf8[512+256];
if(filelist_infop -> current_path == NULL)
return -1;
@@ -1753,7 +1753,7 @@ u32 menu(u16 *screen)
ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
ds2_setCPUclocklevel(13);
- int load_result = load_gamepak(&line_buffer);
+ int load_result = load_gamepak(line_buffer);
ds2_setCPUclocklevel(0);
if(load_result == -1)
{
@@ -1895,7 +1895,6 @@ u32 menu(u16 *screen)
void game_state_menu_passive()
{
- unsigned short color;
unsigned int line[3] = {0, 2, 4};
//draw background
@@ -1942,7 +1941,6 @@ u32 menu(u16 *screen)
PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, 23, 40 + line[i]*27);
}
- int slot_index;
unsigned int selected_write, selected_read;
selected_write = -1;
@@ -1960,7 +1958,6 @@ u32 menu(u16 *screen)
u32 delette_savestate_num= 0;
void gamestate_delette_menu_passive()
{
- unsigned short color;
unsigned int line[2] = {0, 1};
//draw background
@@ -2237,8 +2234,7 @@ u32 menu(u16 *screen)
S9xRemoveCheat(i);
}
// Save current cheat selections to the cheat binary file.
- strcpy(line_buffer, (char *) S9xGetFilename (".chb"));
- S9xSaveCheatFile (line_buffer); // cheat binary
+ S9xSaveCheatFile (S9xGetFilename (".chb"));
}
void dynamic_cheat_key()
@@ -2344,7 +2340,7 @@ u32 menu(u16 *screen)
draw_hscroll_init(down_screen_addr, 23, 40 + m*27, 200,
COLOR_TRANS, COLOR_ACTIVE_ITEM, *dynamic_cheat_options[current_option_num].display_string);
}
- break;
+ break;
case CURSOR_RIGHT:
dynamic_cheat_scroll_value= -5;
@@ -2352,7 +2348,10 @@ u32 menu(u16 *screen)
case CURSOR_LEFT:
dynamic_cheat_scroll_value= 5;
- break;
+ break;
+
+ default:
+ break;
}
}
@@ -2462,9 +2461,8 @@ u32 menu(u16 *screen)
void cheat_option_passive()
{
unsigned short color;
- unsigned char tmp_buf[512];
+ char tmp_buf[512];
unsigned int len;
- unsigned char *pt;
if(display_option == current_option)
color= COLOR_ACTIVE_ITEM;
@@ -2532,7 +2530,6 @@ u32 menu(u16 *screen)
if (!first_load)
{
char *file_ext[] = { ".cht", NULL };
- u32 i, string_num, string_len;
int flag;
if(load_file(file_ext, tmp_filename, DEFAULT_CHEAT_DIR) != -1)
@@ -2540,8 +2537,7 @@ u32 menu(u16 *screen)
sprintf(line_buffer, "%s/%s", DEFAULT_CHEAT_DIR, tmp_filename);
flag = NDSSFCLoadCheatFile(line_buffer);
- strcpy(line_buffer, (char *) S9xGetFilename (".chb"));
- S9xSaveCheatFile (line_buffer); // cheat binary
+ S9xSaveCheatFile (S9xGetFilename (".chb")); // cheat binary
if(0 != flag)
{ //load cheat file failure
@@ -3169,8 +3165,6 @@ u32 menu(u16 *screen)
void latest_game_menu_passive()
{
u32 k;
- unsigned short color;
-
//draw background
show_icon(down_screen_addr, &ICON_SUBBG, 0, 0);
show_icon(down_screen_addr, &ICON_TITLE, 0, 0);
@@ -4023,8 +4017,6 @@ u32 load_font()
--------------------------------------------------------*/
void init_game_config(void)
{
- u32 i;
-
game_config.clock_speed_number = 5; // 396 MHz by default
clock_speed_number = 5;
game_config.graphic = 3; // By default, have a good-looking aspect ratio
@@ -4033,7 +4025,7 @@ void init_game_config(void)
game_config.backward = 0; //time backward disable
game_config.backward_time = 2; //time backward granularity 1s
- savestate_index= 0;
+ savestate_index= 0;
}
/*--------------------------------------------------------
@@ -4372,44 +4364,6 @@ void get_newest_savestate(char *name_buffer)
get_savestate_filename(latest_save, name_buffer);
}
-static u32 parse_line(char *current_line, char *current_str)
-{
- char *line_ptr;
- char *line_ptr_new;
-
- line_ptr = current_line;
- /* NULL or comment or other */
- if((current_line[0] == 0) || (current_line[0] == '#') || (current_line[0] != '!'))
- return -1;
-
- line_ptr++;
-
- line_ptr_new = strchr(line_ptr, '\r');
- while (line_ptr_new != NULL)
- {
- *line_ptr_new = '\n';
- line_ptr_new = strchr(line_ptr, '\r');
- }
-
- line_ptr_new = strchr(line_ptr, '\n');
- if (line_ptr_new == NULL)
- return -1;
-
- *line_ptr_new = 0;
-
- // "\n" to '\n'
- line_ptr_new = strstr(line_ptr, "\\n");
- while (line_ptr_new != NULL)
- {
- *line_ptr_new = '\n';
- memmove((line_ptr_new + 1), (line_ptr_new + 2), (strlen(line_ptr_new + 2) + 1));
- line_ptr_new = strstr(line_ptr_new, "\\n");
- }
-
- strcpy(current_str, line_ptr);
- return 0;
-}
-
static void get_timestamp_string(char *buffer, u16 msg_id, u16 year, u16 mon,
u16 day, u16 wday, u16 hour, u16 min, u16 sec, u32 msec)
{
@@ -4422,19 +4376,6 @@ static void get_timestamp_string(char *buffer, u16 msg_id, u16 year, u16 mon,
day, mon, year, hour, min, sec);
}
-static void get_time_string(char *buff, struct rtc *rtcp)
-{
- get_timestamp_string(buff, 0,
- rtcp -> year +2000,
- rtcp -> month,
- rtcp -> day,
- rtcp -> weekday,
- rtcp -> hours,
- rtcp -> minutes,
- rtcp -> seconds,
- 0);
-}
-
static u32 save_ss_bmp(u16 *image)
{
static unsigned char header[] ={ 'B', 'M', 0x00, 0x00, 0x00, 0x00, 0x00,
diff --git a/source/nds/gui.h b/source/nds/gui.h
index ec0dd1a..5c1fbd1 100644
--- a/source/nds/gui.h
+++ b/source/nds/gui.h
@@ -167,6 +167,7 @@ extern u32 menu(u16 *original_screen);
extern void game_disableAudio();
extern void game_set_frameskip();
extern void set_cpu_clock(u32 num);
+extern int load_language_msg(char *filename, u32 language);
#ifdef __cplusplus
}
diff --git a/source/seta018.cpp b/source/seta018.cpp
index f0b00e1..cafca06 100644
--- a/source/seta018.cpp
+++ b/source/seta018.cpp
@@ -96,7 +96,7 @@ static int line; // line counter
extern "C"{
uint8 S9xGetST018(uint32 Address)
{
- uint8 t;
+ uint8 t = 0; // Initialise to some value for the compiler
uint16 address = (uint16) Address & 0xFFFF;
line++;
@@ -234,8 +234,6 @@ void S9xSetST018(uint8 Byte, uint32 Address)
}
else
{
- static int a=0;
-
//ST018.in_count = 1;
ST018.out_count = 3;
diff --git a/source/snapshot.cpp b/source/snapshot.cpp
index c31d3ac..ad9b131 100644
--- a/source/snapshot.cpp
+++ b/source/snapshot.cpp
@@ -529,7 +529,7 @@ static FreezeData SnapS7RTC [] = {
{OFFSET (last_used),4,INT_V}
};
-static char ROMFilename [_MAX_PATH];
+//static char ROMFilename [_MAX_PATH];
//static char SnapshotFilename [_MAX_PATH];
void FreezeStruct (STREAM stream, char *name, void *base, FreezeData *fields,
@@ -553,8 +553,6 @@ bool8 Snapshot (const char *filename)
bool8 S9xFreezeGame (const char *filename)
{
- STREAM stream = NULL;
-
FILE* fp;
fp = fopen(filename, "w");
if(NULL == fp)
@@ -732,7 +730,7 @@ int S9xUnfreezeFromStream (STREAM stream)
int result;
int version;
- int len = strlen (SNAPSHOT_MAGIC) + 1 + 4 + 1;
+ unsigned int len = strlen (SNAPSHOT_MAGIC) + 1 + 4 + 1;
if (READ_STREAM (buffer, len, stream) != len)
return (WRONG_FORMAT);
if (strncmp (buffer, SNAPSHOT_MAGIC, strlen (SNAPSHOT_MAGIC)) != 0)