Skip to content

Commit

Permalink
Merge commit 'ea4998ced09c4c2cc62964c55487094fe38db32f' into horace
Browse files Browse the repository at this point in the history
* commit 'ea4998ced09c4c2cc62964c55487094fe38db32f':
  Added more events in inputdevice handling
  CPU More compatible option was not always enabled when it should
  Remove custom pissoff timing values
  Formatting cleanup
  Formatting cleanup after merge
  Updated WHDLoad Booter (Customisations from the .uae config) (#646)
  • Loading branch information
HoraceAndTheSpider committed May 24, 2020
2 parents 9b224b9 + ea4998c commit 8de32d1
Show file tree
Hide file tree
Showing 15 changed files with 661 additions and 543 deletions.
102 changes: 53 additions & 49 deletions src/cfgfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1764,8 +1764,8 @@ void cfgfile_save_options(struct zfile* f, struct uae_prefs* p, int type)

for (i = 0; i < MAX_JPORTS; i++)
{
struct jport* jp = &p->jports[i];
int v = jp->id;
auto* jp = &p->jports[i];
auto v = jp->id;
TCHAR tmp1[MAX_DPATH], tmp2[MAX_DPATH];
if (v == JPORT_NONE)
{
Expand Down Expand Up @@ -1836,7 +1836,7 @@ void cfgfile_save_options(struct zfile* f, struct uae_prefs* p, int type)

// this allows us to go through the available function keys
// currently only 'none' and 'hotkey'
for (int m = 0; m < 2; ++m)
for (auto m = 0; m < 2; ++m)
{
switch (m)
{
Expand All @@ -1855,9 +1855,9 @@ void cfgfile_save_options(struct zfile* f, struct uae_prefs* p, int type)
}

// get all of the custom actions
for (int n = 0; n < 14; ++n) // loop through all buttons
for (auto n = 0; n < 14; ++n) // loop through all buttons
{
int b = 0;
auto b = 0;
switch (n)
{
case 0:
Expand Down Expand Up @@ -2319,23 +2319,23 @@ void cfgfile_save_options(struct zfile* f, struct uae_prefs* p, int type)
cfgfile_dwrite_str(f, _T("uaeboard"), uaeboard[p->uaeboard]);

#ifdef AMIBERRY
cfg_write(_T("; "), f);
cfg_write(_T("; "), f);
cfg_write(_T("; *** WHDLoad Booter. Options"), f);
cfg_write(_T("; "), f);
//cfgfile_dwrite_bool , cfgfile_dwrite , cfgfile_dwrite_str
// i think these ^^ will only write if there is a variable to be written
// which we will want, after testing.

cfgfile_write_str (f, _T("whdload_slave"), p->whdbootprefs.slave);
cfgfile_write_bool (f, _T("whdload_showsplash"), p->whdbootprefs.showsplash);
cfgfile_write_bool (f, _T("whdload_buttonwait"), p->whdbootprefs.buttonwait);
cfgfile_write (f, _T("whdload_custom1"), _T("%d"), p->whdbootprefs.custom1);
cfgfile_write (f, _T("whdload_custom2"), _T("%d"), p->whdbootprefs.custom2);
cfgfile_write (f, _T("whdload_custom3"), _T("%d"), p->whdbootprefs.custom3);
cfgfile_write (f, _T("whdload_custom4"), _T("%d"), p->whdbootprefs.custom4);
cfgfile_write (f, _T("whdload_custom5"), _T("%d"), p->whdbootprefs.custom5);
cfgfile_write_str (f, _T("whdload_custom"), p->whdbootprefs.custom);

//cfgfile_dwrite_bool , cfgfile_dwrite , cfgfile_dwrite_str
// i think these ^^ will only write if there is a variable to be written
// which we will want, after testing.

cfgfile_write_str(f, _T("whdload_slave"), p->whdbootprefs.slave);
cfgfile_write_bool(f, _T("whdload_showsplash"), p->whdbootprefs.showsplash);
cfgfile_write_bool(f, _T("whdload_buttonwait"), p->whdbootprefs.buttonwait);
cfgfile_write(f, _T("whdload_custom1"), _T("%d"), p->whdbootprefs.custom1);
cfgfile_write(f, _T("whdload_custom2"), _T("%d"), p->whdbootprefs.custom2);
cfgfile_write(f, _T("whdload_custom3"), _T("%d"), p->whdbootprefs.custom3);
cfgfile_write(f, _T("whdload_custom4"), _T("%d"), p->whdbootprefs.custom4);
cfgfile_write(f, _T("whdload_custom5"), _T("%d"), p->whdbootprefs.custom5);
cfgfile_write_str(f, _T("whdload_custom"), p->whdbootprefs.custom);
#endif
}

Expand Down Expand Up @@ -2830,11 +2830,11 @@ static int cfgfile_parse_host(struct uae_prefs* p, TCHAR* option, TCHAR* value)

#ifdef AMIBERRY
// custom options LOADING
for (int i = 0; i < 4; ++i) // Loop 1 ... all 4 joyports
for (auto i = 0; i < 4; ++i) // Loop 1 ... all 4 joyports
{
struct joypad_map_layout tempcustom = {};

for (int m = 0; m < 2; ++m) // Loop 2 ... none/hotkey function keys
for (auto m = 0; m < 2; ++m) // Loop 2 ... none/hotkey function keys
{
if (m == 0)
{
Expand All @@ -2847,14 +2847,14 @@ static int cfgfile_parse_host(struct uae_prefs* p, TCHAR* option, TCHAR* value)
tempcustom = p->jports[i].amiberry_custom_hotkey;
}

for (int n = 0; n < 14; ++n) // Loop 3 ... all 14 buttons
for (auto n = 0; n < 14; ++n) // Loop 3 ... all 14 buttons
{
_stprintf(tmpbuf, "joyport%d_amiberry_custom_%s_%s", i, tmp1, button_remap_name[n]);

// this is where we need to check if we have this particular option!!
if (!_tcsncmp(option, _T(tmpbuf), sizeof(tmpbuf) / sizeof(TCHAR)))
{
int b = 0;
auto b = 0;
if (find_inputevent(value) > -1) { b = RemapEventList[find_inputevent(value)]; }
//else {b=0;}

Expand Down Expand Up @@ -2889,15 +2889,15 @@ static int cfgfile_parse_host(struct uae_prefs* p, TCHAR* option, TCHAR* value)
} // close loop 1

/* Read in WHDLoad Options */
if (cfgfile_string(option, value, _T("whdload_slave"), p-> whdbootprefs.slave, sizeof p-> whdbootprefs.slave / sizeof (TCHAR))
|| cfgfile_string(option, value, _T("whdload_custom"), p-> whdbootprefs.custom, sizeof p-> whdbootprefs.custom / sizeof (TCHAR))
if (cfgfile_string(option, value, _T("whdload_slave"), p->whdbootprefs.slave, sizeof p->whdbootprefs.slave / sizeof(TCHAR))
|| cfgfile_string(option, value, _T("whdload_custom"), p->whdbootprefs.custom, sizeof p->whdbootprefs.custom / sizeof(TCHAR))
|| cfgfile_intval(option, value, _T("whdload_custom1"), &p->whdbootprefs.custom1, 1)
|| cfgfile_intval(option, value, _T("whdload_custom2"), &p->whdbootprefs.custom2, 1)
|| cfgfile_intval(option, value, _T("whdload_custom3"), &p->whdbootprefs.custom3, 1)
|| cfgfile_intval(option, value, _T("whdload_custom4"), &p->whdbootprefs.custom4, 1)
|| cfgfile_intval(option, value, _T("whdload_custom5"), &p->whdbootprefs.custom5, 1)
|| cfgfile_yesno(option, value, _T("whdload_buttonwait"), &p-> whdbootprefs.buttonwait)
|| cfgfile_yesno(option, value, _T("whdload_showsplash"), &p-> whdbootprefs.showsplash)
|| cfgfile_yesno(option, value, _T("whdload_buttonwait"), &p->whdbootprefs.buttonwait)
|| cfgfile_yesno(option, value, _T("whdload_showsplash"), &p->whdbootprefs.showsplash)
)
{
return 1;
Expand Down Expand Up @@ -6318,7 +6318,7 @@ void default_prefs(struct uae_prefs* p, bool reset, int type)
p->fpu_strict = false;
p->fpu_mode = -1;
p->m68k_speed = 0;
p->cpu_compatible = false;
p->cpu_compatible = true;
p->address_space_24 = true;
p->cpu_cycle_exact = 0;
p->cpu_memory_cycle_exact = 0;
Expand Down Expand Up @@ -6437,7 +6437,7 @@ static void buildin_default_prefs_68020(struct uae_prefs* p)
{
p->cpu_model = 68020;
p->address_space_24 = true;
p->cpu_compatible = false;
p->cpu_compatible = true;
p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE | CSMASK_AGA;
p->chipmem_size = 0x200000;
p->bogomem_size = 0;
Expand Down Expand Up @@ -6483,21 +6483,21 @@ static void buildin_default_prefs(struct uae_prefs* p)

p->chipmem_size = 0x00080000;
p->bogomem_size = 0x00080000;
for (int i = 0; i < MAX_RAM_BOARDS; i++)
for (auto i = 0; i < MAX_RAM_BOARDS; i++)
{
memset(p->fastmem, 0, sizeof(struct ramboard));
memset(p->z3fastmem, 0, sizeof(struct ramboard));
}
p->mbresmem_low_size = 0x00000000;
p->mbresmem_high_size = 0x00000000;
for (int i = 0; i < MAX_RTG_BOARDS; i++)
for (auto& rtgboard : p->rtgboards)
{
p->rtgboards[i].rtgmem_size = 0x00000000;
p->rtgboards[i].rtgmem_type = GFXBOARD_UAE_Z3;
rtgboard.rtgmem_size = 0x00000000;
rtgboard.rtgmem_type = GFXBOARD_UAE_Z3;
}
for (int i = 0; i < MAX_EXPANSION_BOARDS; i++)
for (auto& i : p->expansionboard)
{
memset(&p->expansionboard[i], 0, sizeof(struct boardromconfig));
memset(&i, 0, sizeof(struct boardromconfig));
}

p->cs_rtc = 0;
Expand Down Expand Up @@ -6540,30 +6540,34 @@ static void set_68020_compa(struct uae_prefs* p, int compa, int cd32)
switch (compa)
{
case 0:
p->cpu_compatible = false;
p->m68k_speed = 0;
p->cachesize = 0;
p->compfpu = false;
break;
case 1:
p->cpu_compatible = false;
p->m68k_speed = 0;
p->cachesize = 0;
p->compfpu = false;
break;
case 2:
p->cpu_compatible = false;
p->cpu_compatible = true;
p->m68k_speed = -1;
p->cachesize = 0;
p->compfpu = false;
p->address_space_24 = false;
break;
case 3:
p->cpu_compatible = false;
p->m68k_speed = -1;
p->address_space_24 = false;
p->cachesize = MAX_JIT_CACHE;
p->compfpu = true;
break;
case 4:
p->cpu_compatible = false;
p->address_space_24 = false;
p->cachesize = MAX_JIT_CACHE;
break;
}
if (p->cpu_model >= 68030)
p->address_space_24 = false;
Expand Down Expand Up @@ -6616,9 +6620,9 @@ static int bip_a3000 (struct uae_prefs *p, int config, int compa, int romcheck)
else
p->cachesize = MAX_JIT_CACHE;
p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE;
p->cpu_compatible = p->address_space_24 = 0;
p->cpu_compatible = p->address_space_24 = false;
p->m68k_speed = -1;
p->immediate_blits = 0;
p->immediate_blits = false;
p->produce_sound = 2;
p->floppyslots[0].dfxtype = DRV_35_HD;
p->floppy_speed = 0;
Expand Down Expand Up @@ -6688,9 +6692,9 @@ static int bip_a4000t (struct uae_prefs *p, int config, int compa, int romcheck)
p->fpu_model = 68040;
}
p->chipset_mask = CSMASK_AGA | CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE;
p->cpu_compatible = p->address_space_24 = 0;
p->cpu_compatible = p->address_space_24 = false;
p->m68k_speed = -1;
p->immediate_blits = 0;
p->immediate_blits = false;
p->produce_sound = 2;
p->cachesize = MAX_JIT_CACHE;
p->floppyslots[0].dfxtype = DRV_35_HD;
Expand Down Expand Up @@ -7009,9 +7013,9 @@ static int bip_super (struct uae_prefs *p, int config, int compa, int romcheck)
p->cpu_model = 68040;
p->fpu_model = 68040;
p->chipset_mask = CSMASK_AGA | CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE;
p->cpu_compatible = p->address_space_24 = 0;
p->cpu_compatible = p->address_space_24 = false;
p->m68k_speed = -1;
p->immediate_blits = 1;
p->immediate_blits = true;
p->produce_sound = 2;
p->cachesize = MAX_JIT_CACHE;
p->floppyslots[0].dfxtype = DRV_35_HD;
Expand Down Expand Up @@ -7095,9 +7099,9 @@ static int bip_casablanca(struct uae_prefs *p, int config, int compa, int romche
break;
}
p->chipset_mask = CSMASK_AGA | CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE;
p->cpu_compatible = p->address_space_24 = 0;
p->cpu_compatible = p->address_space_24 = false;
p->m68k_speed = -1;
p->immediate_blits = 0;
p->immediate_blits = false;
p->produce_sound = 2;
p->floppyslots[0].dfxtype = DRV_NONE;
p->floppyslots[1].dfxtype = DRV_NONE;
Expand Down Expand Up @@ -7206,8 +7210,8 @@ int built_in_chipset_prefs(struct uae_prefs* p)
else if (p->cpu_compatible)
{
// very A500-like
p->cs_df0idhw = 0;
p->cs_resetwarning = 0;
p->cs_df0idhw = false;
p->cs_resetwarning = false;
if (p->bogomem_size || p->chipmem_size > 0x80000 || p->fastmem[0].size)
p->cs_rtc = 1;
p->cs_ciatodbug = true;
Expand Down
21 changes: 0 additions & 21 deletions src/custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ static void uae_abort (const TCHAR *format,...)
nomore = 1;
}

#ifdef AMIBERRY
int pissoff_value = 0;
#endif

static unsigned int n_consecutive_skipped = 0;
static unsigned int total_skipped = 0;

Expand Down Expand Up @@ -474,23 +470,6 @@ static int doflickerfix (void)
return currprefs.gfx_vresolution && doublescan < 0 && vpos < MAXVPOS;
}

#ifdef AMIBERRY
void set_speedup_values(void)
{
if (currprefs.m68k_speed < 0) {
if (currprefs.cachesize) {
pissoff_value = (vblank_hz > 55 ? speedup_cycles_jit_ntsc : speedup_cycles_jit_pal) * CYCLE_UNIT;
}
else {
pissoff_value = speedup_cycles_nonjit * CYCLE_UNIT;
}
}
else {
pissoff_value = 0;
}
}
#endif

uae_u32 get_copper_address (int copno)
{
switch (copno) {
Expand Down
44 changes: 15 additions & 29 deletions src/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "newcpu.h"
#include "xwin.h"

static const int pissoff_nojit_value = 256 * CYCLE_UNIT;

unsigned long int nextevent, currcycle;
int is_syncline, is_syncline_end;

Expand Down Expand Up @@ -49,40 +51,18 @@ void events_schedule(void)
static bool event_check_vsync(void)
{
/* Keep only CPU emulation running while waiting for sync point. */
if (is_syncline == -1) {
if (is_syncline == -1
|| is_syncline == -2
|| is_syncline == -3
|| is_syncline > 0
|| is_syncline <= -100) {

if (!isvsync_chipset()) {
events_reset_syncline();
return false;
}
}
else if (is_syncline == -2) {

if (!isvsync_chipset()) {
events_reset_syncline();
return false;
}
}
else if (is_syncline == -3) {
if (!isvsync_chipset()) {
events_reset_syncline();
return false;
}
}
else if (is_syncline > 0)
{
if (!isvsync_chipset()) {
events_reset_syncline();
return false;
}
}
else if (is_syncline <= -100) {

if (!isvsync_chipset()) {
events_reset_syncline();
return false;
}
}
else if (is_syncline == -10) {

// wait is_syncline_end
Expand All @@ -91,7 +71,10 @@ static bool event_check_vsync(void)
int v = rpt - is_syncline_end;
if (v < 0)
{
regs.pissoff = pissoff_value;
if (currprefs.cachesize)
regs.pissoff = pissoff_value;
else
regs.pissoff = pissoff_nojit_value;
return true;
}
//}
Expand All @@ -108,7 +91,10 @@ static bool event_check_vsync(void)
v = 0;
}
if (v < 0 && v2 < 0) {
regs.pissoff = pissoff_value;
if (currprefs.cachesize)
regs.pissoff = pissoff_value;
else
regs.pissoff = pissoff_nojit_value;
return true;
}
//}
Expand Down
1 change: 0 additions & 1 deletion src/include/custom.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#define MAXVPOS_LINES_OCS 512
#define HPOS_SHIFT 3

extern void set_speedup_values(void);
extern int custom_init (void);
extern void custom_prepare (void);
extern void custom_reset (bool hardreset, bool keyboardreset);
Expand Down
Loading

0 comments on commit 8de32d1

Please sign in to comment.