Implemented support for executing commands on Host OS, through emulib
This commit is contained in:
parent
22372fd4e3
commit
fb0bfdb78c
2 changed files with 152 additions and 118 deletions
|
@ -22,8 +22,8 @@
|
|||
#define GETBDM(x) (((x) - (((x) / 10000) * 10000)) / 100)
|
||||
#define GETBDD(x) ((x) % 100)
|
||||
|
||||
#define AMIBERRYVERSION _T("Amiberry v3.2 beta (2020-06-25)")
|
||||
#define AMIBERRYDATE MAKEBD(2020, 6, 25)
|
||||
#define AMIBERRYVERSION _T("Amiberry v3.2 beta (2020-06-26)")
|
||||
#define AMIBERRYDATE MAKEBD(2020, 6, 26)
|
||||
|
||||
extern std::string get_version_string();
|
||||
|
||||
|
|
|
@ -77,13 +77,11 @@ static uae_u32 emulib_SetFrameRate (uae_u32 val)
|
|||
{
|
||||
if (val == 0)
|
||||
return 0;
|
||||
else if (val > 20)
|
||||
if (val > 20)
|
||||
return 0;
|
||||
else {
|
||||
currprefs.gfx_framerate = val;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Changes keyboard language settings
|
||||
|
@ -92,8 +90,8 @@ static uae_u32 emulib_ChangeLanguage (uae_u32 which)
|
|||
{
|
||||
if (which > 6)
|
||||
return 0;
|
||||
else {
|
||||
switch (which) {
|
||||
switch (which)
|
||||
{
|
||||
case 0:
|
||||
currprefs.keyboard_lang = KBD_LANG_US;
|
||||
break;
|
||||
|
@ -120,7 +118,6 @@ static uae_u32 emulib_ChangeLanguage (uae_u32 which)
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* The following ones don't work as we never realloc the arrays... */
|
||||
/*
|
||||
|
@ -130,7 +127,8 @@ static uae_u32 emulib_ChangeLanguage (uae_u32 which)
|
|||
static uae_u32 REGPARAM2 emulib_ChgCMemSize(TrapContext* ctx, uae_u32 memsize)
|
||||
{
|
||||
if (memsize != 0x80000 && memsize != 0x100000 &&
|
||||
memsize != 0x200000) {
|
||||
memsize != 0x200000)
|
||||
{
|
||||
memsize = 0x200000;
|
||||
write_log(_T("Unsupported chipmem size!\n"));
|
||||
}
|
||||
|
@ -148,7 +146,8 @@ static uae_u32 REGPARAM2 emulib_ChgCMemSize(TrapContext *ctx, uae_u32 memsize)
|
|||
static uae_u32 REGPARAM2 emulib_ChgSMemSize(TrapContext* ctx, uae_u32 memsize)
|
||||
{
|
||||
if (memsize != 0x80000 && memsize != 0x100000 &&
|
||||
memsize != 0x180000 && memsize != 0x1C0000) {
|
||||
memsize != 0x180000 && memsize != 0x1C0000)
|
||||
{
|
||||
memsize = 0;
|
||||
write_log(_T("Unsupported bogomem size!\n"));
|
||||
}
|
||||
|
@ -166,7 +165,8 @@ static uae_u32 REGPARAM2 emulib_ChgSMemSize(TrapContext *ctx, uae_u32 memsize)
|
|||
static uae_u32 REGPARAM2 emulib_ChgFMemSize(TrapContext* ctx, uae_u32 memsize)
|
||||
{
|
||||
if (memsize != 0x100000 && memsize != 0x200000 &&
|
||||
memsize != 0x400000 && memsize != 0x800000) {
|
||||
memsize != 0x400000 && memsize != 0x800000)
|
||||
{
|
||||
memsize = 0;
|
||||
write_log(_T("Unsupported fastmem size!\n"));
|
||||
}
|
||||
|
@ -236,7 +236,8 @@ static uae_u32 emulib_GetUaeConfig(TrapContext *ctx, uaecptr place)
|
|||
else
|
||||
trap_put_byte(ctx, place + 35, 1);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
char* s = ua(currprefs.floppyslots[i].df);
|
||||
trap_put_string(ctx, s, place + 36 + i * 256, 256);
|
||||
xfree(s);
|
||||
|
@ -346,9 +347,24 @@ static int native_dos_op(TrapContext *ctx, uae_u32 mode, uae_u32 p1, uae_u32 p2,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static uae_u32 uaelib_demux_common(TrapContext *ctx, uae_u32 ARG0, uae_u32 ARG1, uae_u32 ARG2, uae_u32 ARG3, uae_u32 ARG4, uae_u32 ARG5)
|
||||
// Execute a command on the Host OS
|
||||
static uae_u32 emulib_ExecuteOnHost(TrapContext* ctx, uaecptr name)
|
||||
{
|
||||
char real_name[MAX_DPATH];
|
||||
TCHAR* s;
|
||||
|
||||
if (trap_get_string(ctx, real_name, name, sizeof real_name) >= sizeof real_name)
|
||||
return 0; /* ENAMETOOLONG */
|
||||
|
||||
system(real_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uae_u32 uaelib_demux_common(TrapContext* ctx, uae_u32 ARG0, uae_u32 ARG1, uae_u32 ARG2, uae_u32 ARG3,
|
||||
uae_u32 ARG4, uae_u32 ARG5)
|
||||
{
|
||||
switch (ARG0)
|
||||
{
|
||||
switch (ARG0) {
|
||||
case 0: return emulib_GetVersion();
|
||||
case 1: return emulib_GetUaeConfig(ctx, ARG1);
|
||||
case 2: return emulib_SetUaeConfig(ARG1);
|
||||
|
@ -376,10 +392,14 @@ static uae_u32 uaelib_demux_common(TrapContext *ctx, uae_u32 ARG0, uae_u32 ARG1,
|
|||
return 0xffffffff;
|
||||
case 81: return cfgfile_uaelib(ctx, ARG1, ARG2, ARG3, ARG4);
|
||||
case 82: return cfgfile_uaelib_modify(ctx, ARG1, ARG2, ARG3, ARG4, ARG5);
|
||||
case 83: return 0;
|
||||
case 83: currprefs.mmkeyboard = ARG1 ? 1 : 0; return currprefs.mmkeyboard;
|
||||
#ifdef DEBUGGER
|
||||
case 84: return mmu_init(ARG1, ARG2, ARG3);
|
||||
#endif
|
||||
case 85: return native_dos_op(ctx, ARG1, ARG2, ARG3, ARG4);
|
||||
case 86:
|
||||
if (valid_address(ARG1, 1)) {
|
||||
if (valid_address(ARG1, 1))
|
||||
{
|
||||
uae_char tmp[MAX_DPATH];
|
||||
trap_get_string(ctx, tmp, ARG1, sizeof tmp);
|
||||
TCHAR* s = au(tmp);
|
||||
|
@ -395,11 +415,25 @@ static uae_u32 uaelib_demux_common(TrapContext *ctx, uae_u32 ARG0, uae_u32 ARG1,
|
|||
trap_set_dreg(ctx, 1, d1);
|
||||
return d0;
|
||||
}
|
||||
|
||||
case 88: return emulib_ExecuteOnHost(ctx, ARG1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uae_u32 uaeboard_demux(uae_u32* board)
|
||||
{
|
||||
uae_u32 arg0, arg1, arg2, arg3, arg4, arg5;
|
||||
|
||||
arg0 = do_get_mem_word((uae_u16*)&board[0]);
|
||||
arg1 = do_get_mem_long(&board[2]);
|
||||
arg2 = do_get_mem_long(&board[3]);
|
||||
arg3 = do_get_mem_long(&board[4]);
|
||||
arg4 = do_get_mem_long(&board[5]);
|
||||
arg5 = do_get_mem_long(&board[6]);
|
||||
return uaelib_demux_common(NULL, arg0, arg1, arg2, arg3, arg4, arg5);
|
||||
}
|
||||
|
||||
static uae_u32 REGPARAM2 uaelib_demux2(TrapContext* ctx)
|
||||
{
|
||||
#define ARG0 (trap_get_long(ctx, trap_get_areg(ctx, 7) + 4))
|
||||
|
@ -433,7 +467,7 @@ void emulib_install (void)
|
|||
if (!uae_boot_rom_type && !currprefs.uaeboard)
|
||||
return;
|
||||
a = here();
|
||||
currprefs.mmkeyboard = 0;
|
||||
currprefs.mmkeyboard = false;
|
||||
org(rtarea_base + 0xFF60);
|
||||
calltrap(deftrapres(uaelib_demux, 0, _T("uaelib_demux")));
|
||||
dw(RTS);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue