Fix the keyboard handling. Reset the mixed mode flag when changing video mode. Better path building for savestates.

This commit is contained in:
LemonBoy 2014-04-25 03:31:26 +02:00
parent 57802a979c
commit 8e45768c29
3 changed files with 17 additions and 3 deletions

View File

@ -39,7 +39,7 @@ void update_input ()
kbd_key = keyboardUpdate(); kbd_key = keyboardUpdate();
if (kbd_key > 0) { if (kbd_key > 0) {
switch (keybd_latch) { switch (kbd_key) {
case DVK_ENTER: case DVK_ENTER:
keybd_latch = 0x8d; keybd_latch = 0x8d;
return; return;

View File

@ -11,12 +11,22 @@ typedef struct state_hdr_t {
#define STATE_MAGIC (0x47525033) #define STATE_MAGIC (0x47525033)
char *build_path (int slot)
{
static char tmp[1024];
if (basename)
snprintf(tmp, sizeof(tmp), "%s.%03i", basename, slot);
else
snprintf(tmp, sizeof(tmp), "grape.%03i", slot);
return tmp;
}
int state_save (int slot) int state_save (int slot)
{ {
FILE *f; FILE *f;
state_hdr_t h; state_hdr_t h;
f = fopen("game.sav", "w+"); f = fopen(build_path(slot), "w+");
if (f) if (f)
return 0; return 0;
@ -51,7 +61,7 @@ int state_load (int slot)
FILE *f; FILE *f;
state_hdr_t h; state_hdr_t h;
f = fopen("game.sav", "w+"); f = fopen(build_path(slot), "w+");
if (f) if (f)
return 0; return 0;

View File

@ -112,9 +112,11 @@ u8 video_io_read (u16 addr)
switch (addr&0xf) { switch (addr&0xf) {
case 0x0: case 0x0:
text_mode = 0; text_mode = 0;
mixed_mode = 0;
break; break;
case 0x1: case 0x1:
text_mode = 1; text_mode = 1;
mixed_mode = 0;
break; break;
case 0x2: case 0x2:
mixed_mode = 0; mixed_mode = 0;
@ -130,9 +132,11 @@ u8 video_io_read (u16 addr)
break; break;
case 0x6: case 0x6:
hires = 0; hires = 0;
mixed_mode = 0;
break; break;
case 0x7: case 0x7:
hires = 1; hires = 1;
mixed_mode = 0;
break; break;
// Annunciators // Annunciators
case 0x8: case 0x8: