~code cleanup

~increased held key delay
This commit is contained in:
ekeeke31 2009-06-04 07:47:17 +00:00
parent 9897a460cc
commit 7bddb27c2b
6 changed files with 25 additions and 20 deletions

View File

@ -30,6 +30,12 @@
#define CART_CNT 26 #define CART_CNT 26
/* Global Variables */
T_CART_HW cart_hw;
uint8 j_cart;
uint8 *default_rom;
int old_system[2] = {-1,-1};
/* Function prototypes */ /* Function prototypes */
void default_time_w(uint32 address, uint32 data); void default_time_w(uint32 address, uint32 data);
void special_mapper_w(uint32 address, uint32 data); void special_mapper_w(uint32 address, uint32 data);
@ -54,7 +60,7 @@ typedef struct
- copy protection device - copy protection device
- custom ROM banking device - custom ROM banking device
*/ */
T_CART_ENTRY rom_database[CART_CNT] = static const T_CART_ENTRY rom_database[CART_CNT] =
{ {
/* Game no Kanzume Otokuyou */ /* Game no Kanzume Otokuyou */
{0x0000,0xf9d1,0,0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},0,0,0,seganet_mapper_w,0,0}}, {0x0000,0xf9d1,0,0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},0,0,0,seganet_mapper_w,0,0}},
@ -110,12 +116,9 @@ T_CART_ENTRY rom_database[CART_CNT] =
{0x30b9,0x1c2a,0x40,0x40,{{0,0,0,0},{0,0,0,0},{0,0,0,0},0,0,0,0,default_regs_r,0}} {0x30b9,0x1c2a,0x40,0x40,{{0,0,0,0},{0,0,0,0},{0,0,0,0},0,0,0,0,default_regs_r,0}}
}; };
/* previous inputs */
int old_system[2] = {-1,-1};
/* temporary memory chunk */ /* temporary memory chunk */
uint8 mem_chunk[0x10000]; static uint8 mem_chunk[0x10000];
/************************************************************ /************************************************************
Cart Hardware initialization Cart Hardware initialization

View File

@ -42,9 +42,10 @@ typedef struct
} T_CART_HW; } T_CART_HW;
/* global variables */ /* global variables */
T_CART_HW cart_hw; extern T_CART_HW cart_hw;
uint8 j_cart; extern uint8 j_cart;
uint8 *default_rom; extern uint8 *default_rom;
extern int old_system[2];
/* Function prototypes */ /* Function prototypes */
extern void cart_hw_reset(); extern void cart_hw_reset();

View File

@ -21,6 +21,10 @@
#include "shared.h" #include "shared.h"
#define GAME_CNT 25
T_EEPROM eeprom;
typedef struct typedef struct
{ {
char game_id[14]; char game_id[14];
@ -28,7 +32,7 @@ typedef struct
T_EEPROM_TYPE type; T_EEPROM_TYPE type;
} T_GAME_ENTRY; } T_GAME_ENTRY;
T_GAME_ENTRY database[25] = static const T_GAME_ENTRY database[GAME_CNT] =
{ {
/* ACCLAIM mappers */ /* ACCLAIM mappers */
/* 24C02 (old mapper) */ /* 24C02 (old mapper) */
@ -73,12 +77,9 @@ T_GAME_ENTRY database[25] =
{{"T-120146-50"}, 0, {16, 0x1FFF, 0x1FFF, 0x300000, 0x380001, 0x300000, 0, 7, 1}} /* Brian Lara Cricket 96, Shane Warne Cricket */ {{"T-120146-50"}, 0, {16, 0x1FFF, 0x1FFF, 0x300000, 0x380001, 0x300000, 0, 7, 1}} /* Brian Lara Cricket 96, Shane Warne Cricket */
}; };
T_EEPROM eeprom;
void eeprom_init() void eeprom_init()
{ {
uint8 i = 0; int i = 0;
/* initialize eeprom */ /* initialize eeprom */
memset(&eeprom, 0, sizeof(T_EEPROM)); memset(&eeprom, 0, sizeof(T_EEPROM));
@ -86,10 +87,11 @@ void eeprom_init()
eeprom.scl = eeprom.old_scl = 1; eeprom.scl = eeprom.old_scl = 1;
eeprom.state = STAND_BY; eeprom.state = STAND_BY;
/* no eeprom by default */
sram.custom = 0; sram.custom = 0;
/* look into game database */ /* look into game database */
while ((i<25) && (!sram.custom)) while ((i<GAME_CNT) && (!sram.custom))
{ {
if (strstr(rominfo.product,database[i].game_id) != NULL) if (strstr(rominfo.product,database[i].game_id) != NULL)
{ {

View File

@ -135,7 +135,6 @@ typedef struct
/* Menu inputs */ /* Menu inputs */
struct t_input_menu struct t_input_menu
{ {
u32 connected;
u16 keys; u16 keys;
#ifdef HW_RVL #ifdef HW_RVL
struct ir_t ir; struct ir_t ir;

View File

@ -1045,7 +1045,6 @@ static void videomenu ()
/**************************************************************************** /****************************************************************************
* Controllers Settings menu * Controllers Settings menu
****************************************************************************/ ****************************************************************************/
extern int old_system[2];
/* Set menu elements depending on current system configuration */ /* Set menu elements depending on current system configuration */
static void ctrlmenu_raz(void) static void ctrlmenu_raz(void)

View File

@ -29,10 +29,11 @@
#define ANALOG_SENSITIVITY 30 #define ANALOG_SENSITIVITY 30
/* Delay before held keys triggering */ /* Delay before held keys triggering */
#define HELD_DELAY 18 /* higher is the value, less responsive is the key update */
#define HELD_DELAY 30
/* Direction & selection update speed when a key is being held */ /* Direction & selection update speed when a key is being held */
/* the less is the value, faster is the key update */ /* lower is the value, faster is the key update */
#define HELD_SPEED 4 #define HELD_SPEED 4
/* Menu request flag */ /* Menu request flag */
@ -751,7 +752,7 @@ void gx_input_UpdateEmu(void)
void gx_input_UpdateMenu(u32 cnt) void gx_input_UpdateMenu(u32 cnt)
{ {
/* PAD status update */ /* PAD status update */
m_input.connected = PAD_ScanPads(); PAD_ScanPads();
/* PAD pressed keys */ /* PAD pressed keys */
s16 pp = PAD_ButtonsDown(0); s16 pp = PAD_ButtonsDown(0);