Version 4.7a with new option to enable key click and slight memory improvements so even larger games will load (future-proofing as no games are that large currently).

This commit is contained in:
Dave Bernazzani 2024-01-20 14:28:19 -05:00
parent c1e975578d
commit c3226a865c
15 changed files with 214 additions and 211 deletions

View File

@ -14,7 +14,7 @@ include $(DEVKITARM)/ds_rules
export TARGET := NINTV-DS export TARGET := NINTV-DS
export TOPDIR := $(CURDIR) export TOPDIR := $(CURDIR)
export VERSION := 4.7 export VERSION := 4.7a
ICON := -b $(CURDIR)/logo.bmp "NINTV-DS $(VERSION);wavemotion-dave;https://github.com/wavemotion-dave/NINTV-DS" ICON := -b $(CURDIR)/logo.bmp "NINTV-DS $(VERSION);wavemotion-dave;https://github.com/wavemotion-dave/NINTV-DS"

Binary file not shown.

View File

@ -147,10 +147,10 @@ void CheatMenu(void)
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Read the global nintv-ds.cht file and match it up with our current game // Read the global nintv-ds.cht file and match it up with our current game
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
extern char filebuf[];
void LoadCheats(void) void LoadCheats(void)
{ {
u8 bFound = false; u8 bFound = false;
char filebuf[128];
FILE *fp = NULL; FILE *fp = NULL;
// -------------------------------------------- // --------------------------------------------

View File

@ -169,8 +169,8 @@ static void SetDefaultGameConfig(UINT32 crc)
myConfig.offset_x = 0; myConfig.offset_x = 0;
myConfig.bLatched = 0; myConfig.bLatched = 0;
myConfig.fudgeTiming = 0; myConfig.fudgeTiming = 0;
myConfig.spare3 = 0; myConfig.key_click = 0;
myConfig.spare4 = 0; myConfig.bSkipBlanks = 0;
myConfig.spare5 = 0; myConfig.spare5 = 0;
myConfig.spare6 = 0; myConfig.spare6 = 0;
myConfig.spare7 = 0; myConfig.spare7 = 0;
@ -193,7 +193,6 @@ static void SetDefaultGameConfig(UINT32 crc)
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------
if (crc == 0x2DEACD15) myConfig.bLatched = true; // Stampede must have latched backtab access if (crc == 0x2DEACD15) myConfig.bLatched = true; // Stampede must have latched backtab access
if (crc == 0x573B9B6D) myConfig.bLatched = true; // Masters of the Universe must have latched backtab access if (crc == 0x573B9B6D) myConfig.bLatched = true; // Masters of the Universe must have latched backtab access
if (crc == 0x8AD19AB3) myConfig.frame_skip = 0; // B-17 Bomber no frame skip
if (crc == 0x5F6E1AF6) myConfig.fudgeTiming = 2; // Motocross needs some fudge timing to run... known race condition... if (crc == 0x5F6E1AF6) myConfig.fudgeTiming = 2; // Motocross needs some fudge timing to run... known race condition...
if (crc == 0xfab2992c) myConfig.controller_type = CONTROLLER_DUAL_ACTION_B; // Astrosmash is best with Dual Action B if (crc == 0xfab2992c) myConfig.controller_type = CONTROLLER_DUAL_ACTION_B; // Astrosmash is best with Dual Action B
if (crc == 0xd0f83698) myConfig.controller_type = CONTROLLER_DUAL_ACTION_B; // Astrosmash (competition) is best with Dual Action B if (crc == 0xd0f83698) myConfig.controller_type = CONTROLLER_DUAL_ACTION_B; // Astrosmash (competition) is best with Dual Action B
@ -202,6 +201,7 @@ static void SetDefaultGameConfig(UINT32 crc)
if (crc == 0xc047d487) myConfig.controller_type = CONTROLLER_DUAL_ACTION_B; // Beauty and the Beast is best with Dual Action B if (crc == 0xc047d487) myConfig.controller_type = CONTROLLER_DUAL_ACTION_B; // Beauty and the Beast is best with Dual Action B
if (crc == 0xc047d487) myConfig.dpad_config = DPAD_STRICT_4WAY; // Beauty and the Beast is best with Strict 4-way if (crc == 0xc047d487) myConfig.dpad_config = DPAD_STRICT_4WAY; // Beauty and the Beast is best with Strict 4-way
if (crc == 0xD8C9856A) myConfig.dpad_config = DPAD_DIAGONALS; // Q-Bert is best with diagonal if (crc == 0xD8C9856A) myConfig.dpad_config = DPAD_DIAGONALS; // Q-Bert is best with diagonal
if (crc == 0x8AD19AB3) myConfig.bSkipBlanks = true; // B-17 Bomber needs to skip rendering blanks or the screen 'flashes'
} }
@ -360,6 +360,7 @@ void FindAndLoadConfig(UINT32 crc)
{ {
bConfigWasFound = TRUE; bConfigWasFound = TRUE;
memcpy(&myConfig, &allConfigs.game_config[slot], sizeof(struct Config_t)); memcpy(&myConfig, &allConfigs.game_config[slot], sizeof(struct Config_t));
if (crc == 0x8AD19AB3) myConfig.bSkipBlanks = true; // B-17 Bomber needs to skip rendering blanks or the screen 'flashes'
break; break;
} }
} }
@ -427,6 +428,8 @@ const struct options_t Option_Table[3][20] =
{ {
{"BACKTAB", {"NOT LATCHED", "LATCHED"}, &myConfig.bLatched, 2}, {"BACKTAB", {"NOT LATCHED", "LATCHED"}, &myConfig.bLatched, 2},
{"CPU FUDGE", {"NONE", "LOW", "MEDIUM", "HIGH", "MAX"}, &myConfig.fudgeTiming, 5}, {"CPU FUDGE", {"NONE", "LOW", "MEDIUM", "HIGH", "MAX"}, &myConfig.fudgeTiming, 5},
{"KEYBD CLICK", {"NO" , "YES"}, &myConfig.key_click, 2},
{"SKIP BLANKS", {"NO" , "YES"}, &myConfig.bSkipBlanks, 2},
{NULL, {"", ""}, NULL, 1}, {NULL, {"", ""}, NULL, 1},
}, },

View File

@ -51,8 +51,8 @@ struct Config_t
INT8 offset_x; INT8 offset_x;
UINT8 bLatched; UINT8 bLatched;
UINT8 fudgeTiming; UINT8 fudgeTiming;
UINT8 spare3; UINT8 key_click;
UINT8 spare4; UINT8 bSkipBlanks;
UINT8 spare5; UINT8 spare5;
UINT8 spare6; UINT8 spare6;
UINT8 spare7; UINT8 spare7;

View File

@ -69,8 +69,6 @@ UINT16 mobBuffers[8][128] __attribute__((section(".dtcm")));
UINT8 fgcolor __attribute__((section(".dtcm"))) = 0; UINT8 fgcolor __attribute__((section(".dtcm"))) = 0;
UINT8 bgcolor __attribute__((section(".dtcm"))) = 0; UINT8 bgcolor __attribute__((section(".dtcm"))) = 0;
UINT8 bRenderBlanks = TRUE; // Only B-17 Bomber sets this to false... still debugging it.
// Movable objects // Movable objects
MOB mobs[8] __attribute__((section(".dtcm"))); MOB mobs[8] __attribute__((section(".dtcm")));
@ -218,7 +216,7 @@ ITCM_CODE INT32 AY38900::tick(INT32 minimum) {
if (!displayEnabled) { if (!displayEnabled) {
if (previousDisplayEnabled) if (previousDisplayEnabled)
{ {
if (bRenderBlanks) if (myConfig.bSkipBlanks == 0)
{ {
UINT32 borderColor32 = color_repeat_table[borderColor]; UINT32 borderColor32 = color_repeat_table[borderColor];
UINT32 *ptr = (UINT32 *)pixelBuffer; UINT32 *ptr = (UINT32 *)pixelBuffer;

View File

@ -121,7 +121,7 @@ ITCM_CODE INT32 AudioMixer::tick(INT32 minimum)
extern UINT8 sp_idle; extern UINT8 sp_idle;
UINT16 soundChannelsToProcess = audioProducerCount; UINT16 soundChannelsToProcess = audioProducerCount;
if (bUseIVoice && sp_idle) soundChannelsToProcess--; // If ECS is idle we can skip processing it... if (bUseIVoice && sp_idle) soundChannelsToProcess--; // If the Intellivoice is idle we can skip processing it... Saves CPU time.
for (INT32 totalTicks = 0; totalTicks < minimum; totalTicks++) for (INT32 totalTicks = 0; totalTicks < minimum; totalTicks++)
{ {

View File

@ -14,10 +14,10 @@
#include "types.h" #include "types.h"
#define MAX_MAPPED_MEMORIES 144 #define MAX_MAPPED_MEMORIES 250
#define MAX_PERIPHERALS 4 #define MAX_PERIPHERALS 4
#define MAX_COMPONENTS 4 #define MAX_COMPONENTS 4
#define MAX_ROMS 128 #define MAX_RAM_ROM_SEGMENTS 128
extern UINT32 MAX_ROM_FILE_SIZE; extern UINT32 MAX_ROM_FILE_SIZE;

View File

@ -41,7 +41,7 @@ Processor* Peripheral::GetProcessor(UINT16 i)
void Peripheral::AddRAM(RAM* m) void Peripheral::AddRAM(RAM* m)
{ {
if (ramCount < MAX_ROMS) if (ramCount < MAX_RAM_ROM_SEGMENTS)
{ {
rams[ramCount] = m; rams[ramCount] = m;
ramCount++; ramCount++;
@ -108,7 +108,7 @@ InputConsumer* Peripheral::GetInputConsumer(UINT16 i)
void Peripheral::AddROM(ROM* r) void Peripheral::AddROM(ROM* r)
{ {
if (romCount < MAX_ROMS) if (romCount < MAX_RAM_ROM_SEGMENTS)
{ {
roms[romCount] = r; roms[romCount] = r;
romCount++; romCount++;

View File

@ -227,9 +227,9 @@ class Peripheral
UINT8 audioProducerCount; UINT8 audioProducerCount;
InputConsumer* inputConsumers[MAX_COMPONENTS]; InputConsumer* inputConsumers[MAX_COMPONENTS];
UINT8 inputConsumerCount; UINT8 inputConsumerCount;
RAM* rams[MAX_ROMS]; RAM* rams[MAX_RAM_ROM_SEGMENTS];
UINT8 ramCount; UINT8 ramCount;
ROM* roms[MAX_ROMS]; ROM* roms[MAX_RAM_ROM_SEGMENTS];
UINT8 romCount; UINT8 romCount;
}; };

View File

@ -344,15 +344,6 @@ Rip* Rip::LoadBinCfg(const CHAR* configFile, UINT32 crc, size_t size)
} }
extern UINT8 bRenderBlanks;
bRenderBlanks = TRUE;
// Special handling for B-17 Bomber
if (db_entry->game_crc == 0x8AD19AB3)
{
bRenderBlanks = FALSE;
}
// Now add the required peripherals... // Now add the required peripherals...
if (db_entry->bIntellivoice) if (db_entry->bIntellivoice)
{ {
@ -464,8 +455,8 @@ Rip* Rip::LoadBinCfg(const CHAR* configFile, UINT32 crc, size_t size)
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Make sure we haven't exceeded the maximum number of mapped ROM segments // Make sure we haven't exceeded the maximum number of mapped ROM segments
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
if (rip->GetRAMCount() >= MAX_ROMS) break; if (rip->GetRAMCount() >= MAX_RAM_ROM_SEGMENTS) break;
if (rip->GetROMCount() >= MAX_ROMS) break; if (rip->GetROMCount() >= MAX_RAM_ROM_SEGMENTS) break;
} }
} }
} }
@ -720,9 +711,6 @@ Rip* Rip::LoadRom(const CHAR* filename)
// Load the ECS if asked for... // Load the ECS if asked for...
if (bUseECS) rip->AddPeripheralUsage("ECS", (bUseECS == 3) ? PERIPH_OPTIONAL:PERIPH_REQUIRED); if (bUseECS) rip->AddPeripheralUsage("ECS", (bUseECS == 3) ? PERIPH_OPTIONAL:PERIPH_REQUIRED);
extern UINT8 bRenderBlanks;
bRenderBlanks = TRUE;
return rip; return rip;
} }

View File

@ -146,7 +146,7 @@ BOOL LoadCart(const CHAR* filename)
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
void CheckFirstTimeLoad(void) void CheckFirstTimeLoad(void)
{ {
static bool bFirstTime = true; static UINT8 bFirstTime = true;
// First time in we use the config setting to determine where we open files... // First time in we use the config setting to determine where we open files...
if (bFirstTime) if (bFirstTime)
@ -366,7 +366,7 @@ int intvFilescmp (const void *c1, const void *c2)
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
bool isFavorite(char *filename) bool isFavorite(char *filename)
{ {
for (int i=0; i<64; i++) for (UINT8 i=0; i<64; i++)
{ {
if (myGlobalConfig.favorites[i] != 0x00000000) if (myGlobalConfig.favorites[i] != 0x00000000)
{ {
@ -384,7 +384,7 @@ bool isFavorite(char *filename)
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
void setFavorite(char *filename) void setFavorite(char *filename)
{ {
for (int i=0; i<64; i++) for (UINT8 i=0; i<64; i++)
{ {
if (myGlobalConfig.favorites[i] == 0x00000000) if (myGlobalConfig.favorites[i] == 0x00000000)
{ {
@ -400,7 +400,7 @@ void setFavorite(char *filename)
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
void clrFavorite(char *filename) void clrFavorite(char *filename)
{ {
for (int i=0; i<64; i++) for (UINT8 i=0; i<64; i++)
{ {
if (myGlobalConfig.favorites[i] != 0x00000000) if (myGlobalConfig.favorites[i] != 0x00000000)
{ {
@ -420,7 +420,7 @@ void clrFavorite(char *filename)
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
void intvFindFiles(void) void intvFindFiles(void)
{ {
static bool bFirstTime = true; static UINT8 bFirstTime = true;
DIR *pdir; DIR *pdir;
struct dirent *pent; struct dirent *pent;

View File

@ -40,11 +40,12 @@ char man_buf[MAX_MAN_ROWS][MAX_MAN_COLS +1];
extern Rip *currentRip; extern Rip *currentRip;
extern int bg0, bg0b,bg1b; extern int bg0, bg0b,bg1b;
char filepath[32];
char filebuf[128];
static void ReadManual(void) static void ReadManual(void)
{ {
u8 bFound = false; u8 bFound = false;
char filepath[32];
char filebuf[128];
FILE *fp = NULL; FILE *fp = NULL;
// Read the associated .man file and parse it... // Read the associated .man file and parse it...
if (currentRip != NULL) if (currentRip != NULL)
@ -187,9 +188,9 @@ static void ReadManual(void)
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Show one page (16 lines) of the manual starting at start_line // Show one page (16 lines) of the manual starting at start_line
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
char strBuf[MAX_MAN_COLS +1];
void DisplayManualPage(UINT16 start_line) void DisplayManualPage(UINT16 start_line)
{ {
char strBuf[MAX_MAN_COLS +1];
UINT16 idx=0; UINT16 idx=0;
for (UINT16 i=start_line; i<(start_line+ROWS_PER_PAGE); i++) for (UINT16 i=start_line; i<(start_line+ROWS_PER_PAGE); i++)
{ {
@ -208,7 +209,7 @@ void dsShowManual(void)
{ {
static UINT16 top_line = 0; static UINT16 top_line = 0;
static UINT32 last_crc=0; static UINT32 last_crc=0;
bool bDone=false; UINT8 bDone=false;
int keys_pressed; int keys_pressed;
static int last_keys = -1; static int last_keys = -1;

View File

@ -39,6 +39,7 @@
#include "printf.h" #include "printf.h"
#include "CRC32.h" #include "CRC32.h"
#include "mus_intro_wav.h" #include "mus_intro_wav.h"
#include "keyclick_wav.h"
#include "screenshot.h" #include "screenshot.h"
// -------------------------------------------------------- // --------------------------------------------------------
@ -57,6 +58,8 @@ UINT8 bMetaSpeedup __attribute__((section(".dtcm"))) = false;
UINT8 hud_x = 3; UINT8 hud_x = 3;
UINT8 hud_y = 0; UINT8 hud_y = 0;
UINT16 keypad_pressed = 0;
// ------------------------------------------------------------- // -------------------------------------------------------------
// This one is accessed rather often so we'll put it in .dtcm // This one is accessed rather often so we'll put it in .dtcm
// ------------------------------------------------------------- // -------------------------------------------------------------
@ -660,176 +663,179 @@ void ds_handle_meta(int meta_key)
} }
} }
void poll_touch_screen(UINT16 ctrl_disc, UINT16 ctrl_keys, UINT16 ctrl_side) UINT8 poll_touch_screen(UINT16 ctrl_disc, UINT16 ctrl_keys, UINT16 ctrl_side)
{ {
touchPosition touch; UINT8 pad_pressed = 0;
touchRead(&touch); touchPosition touch;
touchRead(&touch);
#ifdef DEBUG_ENABLE #ifdef DEBUG_ENABLE
if (debugger_input(touch.px, touch.py) == DBG_PRESS_META) if (debugger_input(touch.px, touch.py) == DBG_PRESS_META)
{
while (keysCurrent() & KEY_TOUCH) // Wait for release
{ {
while (keysCurrent() & KEY_TOUCH) // Wait for release
{
WAITVBL;
}
WAITVBL; WAITVBL;
} }
WAITVBL;
}
#endif #endif
// ----------------------------------------------------------- // -----------------------------------------------------------
// Did we map any hotspots on the overlay to disc directions? // Did we map any hotspots on the overlay to disc directions?
// ----------------------------------------------------------- // -----------------------------------------------------------
if (bUseDiscOverlay) if (bUseDiscOverlay)
{
for (int i=0; i < DISC_MAX; i++)
{ {
for (int i=0; i < DISC_MAX; i++) if (touch.px > myDisc[i].x1 && touch.px < myDisc[i].x2 && touch.py > myDisc[i].y1 && touch.py < myDisc[i].y2) ds_disc_input[ctrl_disc][i] = 1;
}
}
// ----------------------------------------------------------------------
// Handle the 12 keypad keys on the intellivision controller overlay...
// ----------------------------------------------------------------------
for (int i=0; i <= OVL_KEY_ENTER; i++)
{
if (touch.px > myOverlay[i].x1 && touch.px < myOverlay[i].x2 && touch.py > myOverlay[i].y1 && touch.py < myOverlay[i].y2) {ds_key_input[ctrl_keys][i] = 1; pad_pressed=1;}
}
// ----------------------------------------------------------------------
// Handle the 3 side buttons (top=Fire... Left-Action and Right-Action)
// ----------------------------------------------------------------------
for (int i=OVL_BTN_FIRE; i<=OVL_BTN_R_ACT; i++)
{
if (touch.px > myOverlay[i].x1 && touch.px < myOverlay[i].x2 && touch.py > myOverlay[i].y1 && touch.py < myOverlay[i].y2) ds_key_input[ctrl_side][i] = 1;
}
// ----------------------------------------------------------------------------------
// Handled "META" keys here... this includes things like RESET, LOAD, CONFIG, etc
// ----------------------------------------------------------------------------------
// RESET
if (touch.px > myOverlay[OVL_META_RESET].x1 && touch.px < myOverlay[OVL_META_RESET].x2 && touch.py > myOverlay[OVL_META_RESET].y1 && touch.py < myOverlay[OVL_META_RESET].y2)
{
ds_handle_meta(OVL_META_RESET);
}
// LOAD
else if (touch.px > myOverlay[OVL_META_LOAD].x1 && touch.px < myOverlay[OVL_META_LOAD].x2 && touch.py > myOverlay[OVL_META_LOAD].y1 && touch.py < myOverlay[OVL_META_LOAD].y2)
{
ds_handle_meta(OVL_META_LOAD);
}
// CONFIG
else if (touch.px > myOverlay[OVL_META_CONFIG].x1 && touch.px < myOverlay[OVL_META_CONFIG].x2 && touch.py > myOverlay[OVL_META_CONFIG].y1 && touch.py < myOverlay[OVL_META_CONFIG].y2)
{
ds_handle_meta(OVL_META_CONFIG);
}
// HIGHSCORES
else if (touch.px > myOverlay[OVL_META_SCORES].x1 && touch.px < myOverlay[OVL_META_SCORES].x2 && touch.py > myOverlay[OVL_META_SCORES].y1 && touch.py < myOverlay[OVL_META_SCORES].y2)
{
ds_handle_meta(OVL_META_SCORES);
}
// STATE
else if (touch.px > myOverlay[OVL_META_STATE].x1 && touch.px < myOverlay[OVL_META_STATE].x2 && touch.py > myOverlay[OVL_META_STATE].y1 && touch.py < myOverlay[OVL_META_STATE].y2)
{
ds_handle_meta(OVL_META_STATE);
}
// QUIT
else if (touch.px > myOverlay[OVL_META_QUIT].x1 && touch.px < myOverlay[OVL_META_QUIT].x2 && touch.py > myOverlay[OVL_META_QUIT].y1 && touch.py < myOverlay[OVL_META_QUIT].y2)
{
ds_handle_meta(OVL_META_QUIT);
}
// MENU
else if (touch.px > myOverlay[OVL_META_MENU].x1 && touch.px < myOverlay[OVL_META_MENU].x2 && touch.py > myOverlay[OVL_META_MENU].y1 && touch.py < myOverlay[OVL_META_MENU].y2)
{
ds_handle_meta(OVL_META_MENU);
}
// SWITCH
else if (touch.px > myOverlay[OVL_META_SWITCH].x1 && touch.px < myOverlay[OVL_META_SWITCH].x2 && touch.py > myOverlay[OVL_META_SWITCH].y1 && touch.py < myOverlay[OVL_META_SWITCH].y2)
{
ds_handle_meta(OVL_META_SWITCH);
}
// MANUAL
else if (touch.px > myOverlay[OVL_META_MANUAL].x1 && touch.px < myOverlay[OVL_META_MANUAL].x2 && touch.py > myOverlay[OVL_META_MANUAL].y1 && touch.py < myOverlay[OVL_META_MANUAL].y2)
{
ds_handle_meta(OVL_META_MANUAL);
}
// ---------------------------------------------------------------------------------------------------------
// And, finally, if the ECS mini-keypad is being shown, we can directly check for any ECS keyboard keys...
// ---------------------------------------------------------------------------------------------------------
if (myConfig.overlay == 1)
{
if ((touch.px > 5) && (touch.px < 98))
{
if (touch.py >= 25 && touch.py < 43) // Row: 1 2 3 4 5
{ {
if (touch.px > myDisc[i].x1 && touch.px < myDisc[i].x2 && touch.py > myDisc[i].y1 && touch.py < myDisc[i].y2) ds_disc_input[ctrl_disc][i] = 1; if (touch.px <= 23) ecs_key_pressed = 1;
else if (touch.px <= 41) ecs_key_pressed = 2;
else if (touch.px <= 60) ecs_key_pressed = 3;
else if (touch.px <= 78) ecs_key_pressed = 4;
else if (touch.px <= 97) ecs_key_pressed = 5;
}
else if (touch.py >= 43 && touch.py < 60) // Row: 6 7 8 9 0
{
if (touch.px <= 23) ecs_key_pressed = 6;
else if (touch.px <= 41) ecs_key_pressed = 7;
else if (touch.px <= 60) ecs_key_pressed = 8;
else if (touch.px <= 78) ecs_key_pressed = 9;
else if (touch.px <= 97) ecs_key_pressed = 10;
}
else if (touch.py >= 60 && touch.py < 78) // Row: A B C D E
{
if (touch.px <= 23) ecs_key_pressed = 11;
else if (touch.px <= 41) ecs_key_pressed = 12;
else if (touch.px <= 60) ecs_key_pressed = 13;
else if (touch.px <= 78) ecs_key_pressed = 14;
else if (touch.px <= 97) ecs_key_pressed = 15;
}
else if (touch.py >= 78 && touch.py < 95) // Row: F G H I J
{
if (touch.px <= 23) ecs_key_pressed = 16;
else if (touch.px <= 41) ecs_key_pressed = 17;
else if (touch.px <= 60) ecs_key_pressed = 18;
else if (touch.px <= 78) ecs_key_pressed = 19;
else if (touch.px <= 97) ecs_key_pressed = 20;
}
else if (touch.py >= 95 && touch.py < 112) // Row: K L M N O
{
if (touch.px <= 23) ecs_key_pressed = 21;
else if (touch.px <= 41) ecs_key_pressed = 22;
else if (touch.px <= 60) ecs_key_pressed = 23;
else if (touch.px <= 78) ecs_key_pressed = 24;
else if (touch.px <= 97) ecs_key_pressed = 25;
}
else if (touch.py >= 112 && touch.py < 130) // Row: P Q R S T
{
if (touch.px <= 23) ecs_key_pressed = 26;
else if (touch.px <= 41) ecs_key_pressed = 27;
else if (touch.px <= 60) ecs_key_pressed = 28;
else if (touch.px <= 78) ecs_key_pressed = 29;
else if (touch.px <= 97) ecs_key_pressed = 30;
}
else if (touch.py >= 130 && touch.py < 148) // Row: U V W X Y
{
if (touch.px <= 23) ecs_key_pressed = 31;
else if (touch.px <= 41) ecs_key_pressed = 32;
else if (touch.px <= 60) ecs_key_pressed = 33;
else if (touch.px <= 78) ecs_key_pressed = 34;
else if (touch.px <= 97) ecs_key_pressed = 35;
}
else if (touch.py >= 148 && touch.py < 166) // Row: Z [arrows]
{
if (touch.px <= 23) ecs_key_pressed = 36;
else if (touch.px <= 41) ecs_key_pressed = 37;
else if (touch.px <= 60) ecs_key_pressed = 38;
else if (touch.px <= 78) ecs_key_pressed = 39;
else if (touch.px <= 97) ecs_key_pressed = 40;
}
else if (touch.py >= 166 && touch.py < 190) // Row: SPC RET
{
if (touch.px <= 50) ecs_key_pressed = 41;
else if (touch.px <= 97) ecs_key_pressed = 42;
} }
} }
}
// ---------------------------------------------------------------------- return pad_pressed;
// Handle the 12 keypad keys on the intellivision controller overlay...
// ----------------------------------------------------------------------
for (int i=0; i <= OVL_KEY_ENTER; i++)
{
if (touch.px > myOverlay[i].x1 && touch.px < myOverlay[i].x2 && touch.py > myOverlay[i].y1 && touch.py < myOverlay[i].y2) ds_key_input[ctrl_keys][i] = 1;
}
// ----------------------------------------------------------------------
// Handle the 3 side buttons (top=Fire... Left-Action and Right-Action)
// ----------------------------------------------------------------------
for (int i=OVL_BTN_FIRE; i<=OVL_BTN_R_ACT; i++)
{
if (touch.px > myOverlay[i].x1 && touch.px < myOverlay[i].x2 && touch.py > myOverlay[i].y1 && touch.py < myOverlay[i].y2) ds_key_input[ctrl_side][i] = 1;
}
// ----------------------------------------------------------------------------------
// Handled "META" keys here... this includes things like RESET, LOAD, CONFIG, etc
// ----------------------------------------------------------------------------------
// RESET
if (touch.px > myOverlay[OVL_META_RESET].x1 && touch.px < myOverlay[OVL_META_RESET].x2 && touch.py > myOverlay[OVL_META_RESET].y1 && touch.py < myOverlay[OVL_META_RESET].y2)
{
ds_handle_meta(OVL_META_RESET);
}
// LOAD
else if (touch.px > myOverlay[OVL_META_LOAD].x1 && touch.px < myOverlay[OVL_META_LOAD].x2 && touch.py > myOverlay[OVL_META_LOAD].y1 && touch.py < myOverlay[OVL_META_LOAD].y2)
{
ds_handle_meta(OVL_META_LOAD);
}
// CONFIG
else if (touch.px > myOverlay[OVL_META_CONFIG].x1 && touch.px < myOverlay[OVL_META_CONFIG].x2 && touch.py > myOverlay[OVL_META_CONFIG].y1 && touch.py < myOverlay[OVL_META_CONFIG].y2)
{
ds_handle_meta(OVL_META_CONFIG);
}
// HIGHSCORES
else if (touch.px > myOverlay[OVL_META_SCORES].x1 && touch.px < myOverlay[OVL_META_SCORES].x2 && touch.py > myOverlay[OVL_META_SCORES].y1 && touch.py < myOverlay[OVL_META_SCORES].y2)
{
ds_handle_meta(OVL_META_SCORES);
}
// STATE
else if (touch.px > myOverlay[OVL_META_STATE].x1 && touch.px < myOverlay[OVL_META_STATE].x2 && touch.py > myOverlay[OVL_META_STATE].y1 && touch.py < myOverlay[OVL_META_STATE].y2)
{
ds_handle_meta(OVL_META_STATE);
}
// QUIT
else if (touch.px > myOverlay[OVL_META_QUIT].x1 && touch.px < myOverlay[OVL_META_QUIT].x2 && touch.py > myOverlay[OVL_META_QUIT].y1 && touch.py < myOverlay[OVL_META_QUIT].y2)
{
ds_handle_meta(OVL_META_QUIT);
}
// MENU
else if (touch.px > myOverlay[OVL_META_MENU].x1 && touch.px < myOverlay[OVL_META_MENU].x2 && touch.py > myOverlay[OVL_META_MENU].y1 && touch.py < myOverlay[OVL_META_MENU].y2)
{
ds_handle_meta(OVL_META_MENU);
}
// SWITCH
else if (touch.px > myOverlay[OVL_META_SWITCH].x1 && touch.px < myOverlay[OVL_META_SWITCH].x2 && touch.py > myOverlay[OVL_META_SWITCH].y1 && touch.py < myOverlay[OVL_META_SWITCH].y2)
{
ds_handle_meta(OVL_META_SWITCH);
}
// MANUAL
else if (touch.px > myOverlay[OVL_META_MANUAL].x1 && touch.px < myOverlay[OVL_META_MANUAL].x2 && touch.py > myOverlay[OVL_META_MANUAL].y1 && touch.py < myOverlay[OVL_META_MANUAL].y2)
{
ds_handle_meta(OVL_META_MANUAL);
}
// ---------------------------------------------------------------------------------------------------------
// And, finally, if the ECS mini-keypad is being shown, we can directly check for any ECS keyboard keys...
// ---------------------------------------------------------------------------------------------------------
if (myConfig.overlay == 1)
{
if ((touch.px > 5) && (touch.px < 98))
{
if (touch.py >= 25 && touch.py < 43) // Row: 1 2 3 4 5
{
if (touch.px <= 23) ecs_key_pressed = 1;
else if (touch.px <= 41) ecs_key_pressed = 2;
else if (touch.px <= 60) ecs_key_pressed = 3;
else if (touch.px <= 78) ecs_key_pressed = 4;
else if (touch.px <= 97) ecs_key_pressed = 5;
}
else if (touch.py >= 43 && touch.py < 60) // Row: 6 7 8 9 0
{
if (touch.px <= 23) ecs_key_pressed = 6;
else if (touch.px <= 41) ecs_key_pressed = 7;
else if (touch.px <= 60) ecs_key_pressed = 8;
else if (touch.px <= 78) ecs_key_pressed = 9;
else if (touch.px <= 97) ecs_key_pressed = 10;
}
else if (touch.py >= 60 && touch.py < 78) // Row: A B C D E
{
if (touch.px <= 23) ecs_key_pressed = 11;
else if (touch.px <= 41) ecs_key_pressed = 12;
else if (touch.px <= 60) ecs_key_pressed = 13;
else if (touch.px <= 78) ecs_key_pressed = 14;
else if (touch.px <= 97) ecs_key_pressed = 15;
}
else if (touch.py >= 78 && touch.py < 95) // Row: F G H I J
{
if (touch.px <= 23) ecs_key_pressed = 16;
else if (touch.px <= 41) ecs_key_pressed = 17;
else if (touch.px <= 60) ecs_key_pressed = 18;
else if (touch.px <= 78) ecs_key_pressed = 19;
else if (touch.px <= 97) ecs_key_pressed = 20;
}
else if (touch.py >= 95 && touch.py < 112) // Row: K L M N O
{
if (touch.px <= 23) ecs_key_pressed = 21;
else if (touch.px <= 41) ecs_key_pressed = 22;
else if (touch.px <= 60) ecs_key_pressed = 23;
else if (touch.px <= 78) ecs_key_pressed = 24;
else if (touch.px <= 97) ecs_key_pressed = 25;
}
else if (touch.py >= 112 && touch.py < 130) // Row: P Q R S T
{
if (touch.px <= 23) ecs_key_pressed = 26;
else if (touch.px <= 41) ecs_key_pressed = 27;
else if (touch.px <= 60) ecs_key_pressed = 28;
else if (touch.px <= 78) ecs_key_pressed = 29;
else if (touch.px <= 97) ecs_key_pressed = 30;
}
else if (touch.py >= 130 && touch.py < 148) // Row: U V W X Y
{
if (touch.px <= 23) ecs_key_pressed = 31;
else if (touch.px <= 41) ecs_key_pressed = 32;
else if (touch.px <= 60) ecs_key_pressed = 33;
else if (touch.px <= 78) ecs_key_pressed = 34;
else if (touch.px <= 97) ecs_key_pressed = 35;
}
else if (touch.py >= 148 && touch.py < 166) // Row: Z [arrows]
{
if (touch.px <= 23) ecs_key_pressed = 36;
else if (touch.px <= 41) ecs_key_pressed = 37;
else if (touch.px <= 60) ecs_key_pressed = 38;
else if (touch.px <= 78) ecs_key_pressed = 39;
else if (touch.px <= 97) ecs_key_pressed = 40;
}
else if (touch.py >= 166 && touch.py < 190) // Row: SPC RET
{
if (touch.px <= 50) ecs_key_pressed = 41;
else if (touch.px <= 97) ecs_key_pressed = 42;
}
}
}
} }
// ------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------
@ -879,7 +885,6 @@ ITCM_CODE void pollInputs(void)
// Unless told otherwise, we are NOT in un-throttle mode... // Unless told otherwise, we are NOT in un-throttle mode...
bMetaSpeedup = false; bMetaSpeedup = false;
// If one of the NDS keys is pressed... // If one of the NDS keys is pressed...
if (keys_pressed & (KEY_UP | KEY_DOWN | KEY_LEFT | KEY_RIGHT | KEY_L | KEY_R | KEY_A | KEY_B | KEY_X | KEY_Y | KEY_SELECT | KEY_START)) if (keys_pressed & (KEY_UP | KEY_DOWN | KEY_LEFT | KEY_RIGHT | KEY_L | KEY_R | KEY_A | KEY_B | KEY_X | KEY_Y | KEY_SELECT | KEY_START))
{ {
@ -1198,8 +1203,17 @@ ITCM_CODE void pollInputs(void)
// ----------------------------------------------------------------- // -----------------------------------------------------------------
if (keys_pressed & KEY_TOUCH) if (keys_pressed & KEY_TOUCH)
{ {
poll_touch_screen(ctrl_disc, ctrl_keys, ctrl_side); if (poll_touch_screen(ctrl_disc, ctrl_keys, ctrl_side)) // Returns non-zero if we pressed one of the 12 keypad keys
} {
if (++keypad_pressed == 3) // Need to see it pressed for several frames
{
if (myConfig.key_click)
{
soundPlaySample(keyclick_wav, SoundFormat_16Bit, keyclick_wav_size, 44100, 127, 64, false, 0);
}
}
} else keypad_pressed = 0;
} else keypad_pressed = 0;
} }
@ -1230,7 +1244,6 @@ void dsShowScreenMain(bool bFull, bool bPlayJingle)
} }
} }
hud_x = 3; hud_x = 3;
hud_y = 0; hud_y = 0;
@ -1252,13 +1265,13 @@ void dsShowScreenMain(bool bFull, bool bPlayJingle)
// -------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------
void dsInitScreenMain(void) void dsInitScreenMain(void)
{ {
vramSetBankB(VRAM_B_LCD ); // Not using this for video but 128K of faster RAM always useful! Mapped at 0x06820000 - Used for Memory Bus Read Counter vramSetBankB(VRAM_B_LCD); // Not using this for video but 128K of faster RAM always useful! Mapped at 0x06820000 - Used for Memory Bus Read Counter
vramSetBankD(VRAM_D_LCD ); // Not using this for video but 128K of faster RAM always useful! Mapped at 0x06860000 - Used for Cart "Fast Buffer" 64k x 16 = 128k vramSetBankD(VRAM_D_LCD); // Not using this for video but 128K of faster RAM always useful! Mapped at 0x06860000 - Used for Cart "Fast Buffer" 64k x 16 = 128k
vramSetBankE(VRAM_E_LCD ); // Not using this for video but 64K of faster RAM always useful! Mapped at 0x06880000 - Used for Custom Tile Overlay Buffer (60K for tile[] buffer, 4K for map[] buffer) vramSetBankE(VRAM_E_LCD); // Not using this for video but 64K of faster RAM always useful! Mapped at 0x06880000 - Used for Custom Tile Overlay Buffer (60K for tile[] buffer, 4K for map[] buffer)
vramSetBankF(VRAM_F_LCD ); // Not using this for video but 16K of faster RAM always useful! Mapped at 0x06890000 - Slow 8-bit RAM buffer for ECS and games like USFC Chess and Land Battle (8K) vramSetBankF(VRAM_F_LCD); // Not using this for video but 16K of faster RAM always useful! Mapped at 0x06890000 - Slow 8-bit RAM buffer for ECS and games like USFC Chess and Land Battle (8K)
vramSetBankG(VRAM_G_LCD ); // Not using this for video but 16K of faster RAM always useful! Mapped at 0x06894000 - JLP RAM Buffer (8K Words or 16K Bytes) vramSetBankG(VRAM_G_LCD); // Not using this for video but 16K of faster RAM always useful! Mapped at 0x06894000 - JLP RAM Buffer (8K Words or 16K Bytes)
vramSetBankH(VRAM_H_LCD ); // Not using this for video but 32K of faster RAM always useful! Mapped at 0x06898000 - Slow 16-bit RAM buffer (16K Words or 32K Bytes) vramSetBankH(VRAM_H_LCD); // Not using this for video but 32K of faster RAM always useful! Mapped at 0x06898000 - Slow 16-bit RAM buffer (16K Words or 32K Bytes)
vramSetBankI(VRAM_I_LCD ); // Not using this for video but 16K of faster RAM always useful! Mapped at 0x068A0000 - Unused vramSetBankI(VRAM_I_LCD); // Not using this for video but 16K of faster RAM always useful! Mapped at 0x068A0000 - Unused
WAITVBL; WAITVBL;
} }

Binary file not shown.