This commit is contained in:
yui 2004-08-12 18:54:26 +00:00
parent 94ebcbfd55
commit 07719ce072
6 changed files with 138 additions and 82 deletions

View File

@ -62,8 +62,10 @@ typedef unsigned int DWORD;
#define SUPPORT_SJIS #define SUPPORT_SJIS
#define MEMOPTIMIZE 1
#define SUPPORT_32BPP #define SUPPORT_32BPP
#define MEMOPTIMIZE 1 #define SUPPORT_RESUME
#define SUPPORT_STATSAVE 10
#define SOUNDRESERVE 80 #define SOUNDRESERVE 80

View File

@ -17,6 +17,9 @@
#include "iocore.h" #include "iocore.h"
#include "timing.h" #include "timing.h"
#include "keystat.h" #include "keystat.h"
#if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE)
#include "statsave.h"
#endif
#include "debugsub.h" #include "debugsub.h"
#include "scrndraw.h" #include "scrndraw.h"
#include "makescrn.h" #include "makescrn.h"
@ -28,7 +31,16 @@
// #define USE_RESUME // #define USE_RESUME
XMILOSCFG xmiloscfg = {100, 100, 0, 0, 0, 0, 0, 0}; XMILOSCFG xmiloscfg = { 100, 100,
0, 0, 0,
0, 0,
#if defined(SUPPORT_RESUME)
0,
#endif
#if defined(SUPPORT_STATSAVE)
1,
#endif
0};
WindowPtr hWndMain; WindowPtr hWndMain;
BRESULT xmilrunning; BRESULT xmilrunning;
@ -44,13 +56,68 @@ static REG8 scrnmode;
#endif #endif
static char target[MAX_PATH] = DEFAULTPATH; static char target[MAX_PATH] = DEFAULTPATH;
#if !defined(SUPPORT_PC9821)
static const char np2app[] = "np2"; static const char xmilapp[] = "xmil";
#else
static const char np2app[] = "np21";
// ---- stat save...
#if defined(SUPPORT_RESUME)
static const char xmilresumeext[] = ".sav";
#endif
#if defined(SUPPORT_STATSAVE)
static const char xmilflagext[] = ".sv%u";
#endif #endif
static const char np2resume[] = "sav"; #if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE)
static void getstatfilename(char *path, const char *ext, UINT size) {
file_cpyname(path, file_getcd(xmilapp), size);
file_catname(path, ext, size);
}
static void flagsave(const char *ext) {
char path[MAX_PATH];
getstatfilename(path, ext, NELEMENTS(path));
statsave_save(path);
}
static void flagdelete(const char *ext) {
char path[MAX_PATH];
getstatfilename(path, ext, NELEMENTS(path));
file_delete(path);
}
static int flagload(const char *ext, BRESULT force) {
int ret;
char path[MAX_PATH];
char buf[1024];
int r;
ret = IDOK;
getstatfilename(path, ext, NELEMENTS(path));
r = statsave_check(path, buf, NELEMENTS(buf));
if (r & (~STATFLAG_DISKCHG)) {
ResumeErrorDialogProc();
ret = IDCANCEL;
}
else if ((!force) && (r & STATFLAG_DISKCHG)) {
ret = ResumeWarningDialogProc(buf);
}
else {
ret = IDOK;
}
if (ret == IDOK) {
statsave_load(path);
}
return(ret);
}
#endif
// ---- ‚¨‚Ü‚¶‚È‚¢ // ---- ‚¨‚Ü‚¶‚È‚¢
@ -124,8 +191,26 @@ static void MenuBarInit(void) {
EnableItem(GetMenuHandle(IDM_DEVICE), LoWord(IDM_MOUSE)); EnableItem(GetMenuHandle(IDM_DEVICE), LoWord(IDM_MOUSE));
#endif #endif
DeleteMenu(IDM_FDD2); if (!(xmilcfg.fddequip & (1 << 3))) {
DeleteMenu(IDM_FDD3); DeleteMenu(IDM_FDD3);
}
if (!(xmilcfg.fddequip & (1 << 2))) {
DeleteMenu(IDM_FDD2);
}
if (!(xmilcfg.fddequip & (1 << 1))) {
DeleteMenu(IDM_FDD1);
}
if (!(xmilcfg.fddequip & (1 << 0))) {
DeleteMenu(IDM_FDD0);
}
#if defined(SUPPORT_STATSAVE)
if (!xmiloscfg.statsave) {
#endif
DeleteMenu(IDM_STATSAVE);
#if defined(SUPPORT_STATSAVE)
}
#endif
DrawMenuBar(); DrawMenuBar();
} }
@ -134,6 +219,10 @@ static void HandleMenuChoice(long wParam) {
UINT update; UINT update;
Str255 applname; Str255 applname;
#if defined(SUPPORT_STATSAVE)
UINT num;
char ext[16];
#endif
update = 0; update = 0;
switch(wParam) { switch(wParam) {
@ -229,17 +318,11 @@ static void HandleMenuChoice(long wParam) {
break; break;
case IDM_WIDTH80: case IDM_WIDTH80:
crtc.s.TXT_XL = 80; crtc_forcesetwidth(80);
// crtc.s.GRP_XL = 640;
vrambank_patch();
scrnallflash = 1;
break; break;
case IDM_WIDTH40: case IDM_WIDTH40:
crtc.s.TXT_XL = 40; crtc_forcesetwidth(40);
// crtc.s.GRP_XL = 320;
vrambank_patch();
scrnallflash = 1;
break; break;
case IDM_DISPSYNC: case IDM_DISPSYNC:
@ -355,6 +438,19 @@ static void HandleMenuChoice(long wParam) {
(void)OpenDeskAcc(applname); (void)OpenDeskAcc(applname);
#endif #endif
} }
#if defined(SUPPORT_STATSAVE)
else if (HiWord(wParam) == IDM_STATSAVE) {
num = LoWord(wParam);
if ((num >= 1) && (num < (1 + 10))) {
OEMSPRINTF(ext, xmilflagext, num - 1);
flagsave(ext);
}
else if ((num >= 12) && (num < (12 + 10))) {
OEMSPRINTF(ext, xmilflagext, num - 12);
flagload(ext, TRUE);
}
}
#endif
break; break;
} }
sysmng_update(update); sysmng_update(update);
@ -482,57 +578,6 @@ static void eventproc(EventRecord *event) {
} }
#if 0
// ----
static void getstatfilename(char *path, const char *ext, int size) {
file_cpyname(path, file_getcd(np2app), size);
file_catname(path, str_dot, size);
file_catname(path, ext, size);
}
static void flagsave(const char *ext) {
char path[MAX_PATH];
getstatfilename(path, ext, sizeof(path));
statsave_save(path);
}
static void flagdelete(const char *ext) {
char path[MAX_PATH];
getstatfilename(path, ext, sizeof(path));
file_delete(path);
}
static int flagload(const char *ext) {
int ret;
char path[MAX_PATH];
char buf[1024];
int r;
ret = IDOK;
getstatfilename(path, ext, sizeof(path));
r = statsave_check(path, buf, sizeof(buf));
if (r & (~STATFLAG_DISKCHG)) {
ResumeErrorDialogProc();
ret = IDCANCEL;
}
else if (r & STATFLAG_DISKCHG) {
ret = ResumeWarningDialogProc(buf);
}
if (ret == IDOK) {
statsave_load(path);
}
return(ret);
}
#endif
// ---- // ----
static UINT framecnt = 0; static UINT framecnt = 0;
@ -644,9 +689,9 @@ int main(int argc, char *argv[]) {
pccore_initialize(); pccore_initialize();
pccore_reset(); pccore_reset();
#if 0 #if defined(SUPPORT_RESUME)
if (np2oscfg.resume) { if (xmiloscfg.resume) {
flagload(np2resume); flagload(xmilresumeext, FALSE);
} }
#endif #endif
@ -731,12 +776,12 @@ int main(int argc, char *argv[]) {
xmilrunning = FALSE; xmilrunning = FALSE;
#if 0 #if defined(SUPPORT_RESUME)
if (np2oscfg.resume) { if (xmiloscfg.resume) {
flagsave(np2resume); flagsave(xmilresumeext);
} }
else { else {
flagdelete(np2resume); flagdelete(xmilresumeext);
} }
#endif #endif

View File

@ -10,6 +10,13 @@ typedef struct {
UINT8 F11KEY; UINT8 F11KEY;
UINT8 F12KEY; UINT8 F12KEY;
#if defined(SUPPORT_RESUME)
UINT8 resume;
#endif
#if defined(SUPPORT_STATSAVE)
UINT8 statsave;
#endif
UINT8 Z80SAVE; UINT8 Z80SAVE;
} XMILOSCFG; } XMILOSCFG;

Binary file not shown.

View File

@ -1,6 +1,6 @@
data 'MBAR' (128) { data 'MBAR' (128) {
$"000B 0080 0081 0084 0085 0086 0087 0088" /* ....<2E>..…..‡.ˆ */ $"000C 0080 0081 0083 0084 0085 0086 0087" /* ....<2E>.ƒ..…..‡ */
$"0089 008A 008B 008C" /* .‰.Š. */ $"0088 0089 008A 008B 008C" /* .ˆ..Š. */
}; };
data 'MENU' (128) { data 'MENU' (128) {
@ -61,7 +61,7 @@ data 'MENU' (131) {
$"4C6F 6164 3500 0000 0005 4C6F 6164 3600" /* Load5.....Load6. */ $"4C6F 6164 3500 0000 0005 4C6F 6164 3600" /* Load5.....Load6. */
$"0000 0005 4C6F 6164 3700 0000 0005 4C6F" /* ....Load7.....Lo */ $"0000 0005 4C6F 6164 3700 0000 0005 4C6F" /* ....Load7.....Lo */
$"6164 3800 0000 0005 4C6F 6164 3900 0000" /* ad8.....Load9... */ $"6164 3800 0000 0005 4C6F 6164 3900 0000" /* ad8.....Load9... */
$"0001 0000 0000 0000" /* ........ */ $"0000" /* .. */
}; };
data 'MENU' (134) { data 'MENU' (134) {
@ -499,3 +499,4 @@ data 'icl4' (128) {
$"0000 0FF0 00CF 00FF FF00 FCC0 0FF0 0000" /* ...ð.Ï.ÿÿ.üÀ.ð.. */ $"0000 0FF0 00CF 00FF FF00 FCC0 0FF0 0000" /* ...ð.Ï.ÿÿ.üÀ.ð.. */
$"0000 000F FFFF FFF0 0FFF FFFF F000 0000" /* ....ÿÿÿð.ÿÿÿð... */ $"0000 000F FFFF FFF0 0FFF FFFF F000 0000" /* ....ÿÿÿð.ÿÿÿð... */
}; };

View File

@ -117,7 +117,7 @@ static void dispbmp(HINSTANCE hinst, HDC hdc,
// ---- // ----
#if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE) #if defined(SUPPORT_RESUME)
static const OEMCHAR xmilresumeext[] = OEMTEXT(".sav"); static const OEMCHAR xmilresumeext[] = OEMTEXT(".sav");
#endif #endif
#if defined(SUPPORT_STATSAVE) #if defined(SUPPORT_STATSAVE)
@ -126,7 +126,6 @@ static const OEMCHAR str_statload[] = OEMTEXT("Status Load");
#endif #endif
#if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE) #if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE)
static const OEMCHAR str_loaderr[] = OEMTEXT("Couldn't restart"); static const OEMCHAR str_loaderr[] = OEMTEXT("Couldn't restart");
static const OEMCHAR str_conflict[] = OEMTEXT("Conflict!\n\n%s\nContinue?"); static const OEMCHAR str_conflict[] = OEMTEXT("Conflict!\n\n%s\nContinue?");
@ -160,7 +159,7 @@ static void flagdelete(const OEMCHAR *ext) {
file_delete(path); file_delete(path);
} }
static int flagload(const OEMCHAR *ext, const OEMCHAR *title, BOOL force) { static int flagload(const OEMCHAR *ext, const OEMCHAR *title, BRESULT force) {
int ret; int ret;
int id; int id;
@ -199,7 +198,9 @@ static int flagload(const OEMCHAR *ext, const OEMCHAR *title, BOOL force) {
static void xmilcmd(HWND hWnd, UINT cmd) { static void xmilcmd(HWND hWnd, UINT cmd) {
UINT update; UINT update;
#if defined(SUPPORT_STATSAVE)
OEMCHAR ext[16]; OEMCHAR ext[16];
#endif
update = 0; update = 0;
switch(cmd) { switch(cmd) {