rearrange globals

scripted find/replace
gives slightly better code on ARM, less unnecessary asm,
~400 bytes saved
This commit is contained in:
notaz 2017-10-19 02:38:20 +03:00
parent 759c9d3846
commit 93f9619ed8
47 changed files with 532 additions and 573 deletions

View file

@ -424,7 +424,7 @@ int YM2612UpdateOne_940(int *buffer, int length, int stereo, int is_buf_empty)
int mp3dec_decode(FILE *f, int *file_pos, int file_len)
{
if (!(PicoOpt & POPT_EXT_FM)) {
if (!(PicoIn.opt & POPT_EXT_FM)) {
//mp3_update_local(buffer, length, stereo);
return 0;
}
@ -456,7 +456,7 @@ int mp3dec_decode(FILE *f, int *file_pos, int file_len)
int mp3dec_start(FILE *f, int fpos_start)
{
if (!(PicoOpt & POPT_EXT_FM)) {
if (!(PicoIn.opt & POPT_EXT_FM)) {
//mp3_start_play_local(f, pos);
return -1;
}

View file

@ -70,7 +70,7 @@ void pemu_prep_defconfig(void)
void pemu_validate_config(void)
{
if (gp2x_dev_id != GP2X_DEV_GP2X)
PicoOpt &= ~POPT_EXT_FM;
PicoIn.opt &= ~POPT_EXT_FM;
if (gp2x_dev_id != GP2X_DEV_WIZ)
currentConfig.EmuOpt &= ~EOPT_WIZ_TEAR_FIX;
@ -83,7 +83,7 @@ void pemu_validate_config(void)
static int get_renderer(void)
{
if (PicoAHW & PAHW_32X)
if (PicoIn.AHW & PAHW_32X)
return currentConfig.renderer32x;
else
return currentConfig.renderer;
@ -92,14 +92,14 @@ static int get_renderer(void)
static void change_renderer(int diff)
{
int *r;
if (PicoAHW & PAHW_32X)
if (PicoIn.AHW & PAHW_32X)
r = &currentConfig.renderer32x;
else
r = &currentConfig.renderer;
*r += diff;
// 8bpp fast is not there (yet?)
if ((PicoAHW & PAHW_SMS) && *r == RT_8BIT_FAST)
if ((PicoIn.AHW & PAHW_SMS) && *r == RT_8BIT_FAST)
(*r)++;
if (*r >= RT_COUNT)
@ -109,7 +109,7 @@ static void change_renderer(int diff)
}
#define is_16bit_mode() \
(get_renderer() == RT_16BIT || (PicoAHW & PAHW_32X))
(get_renderer() == RT_16BIT || (PicoIn.AHW & PAHW_32X))
static void (*osd_text)(int x, int y, const char *text);
@ -201,7 +201,7 @@ static void draw_pico_ptr(void)
x = pico_pen_x + PICO_PEN_ADJUST_X;
y = pico_pen_y + PICO_PEN_ADJUST_Y;
if (!(Pico.video.reg[12]&1) && !(PicoOpt & POPT_DIS_32C_BORDER))
if (!(Pico.video.reg[12]&1) && !(PicoIn.opt & POPT_DIS_32C_BORDER))
x += 32;
if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) {
@ -231,7 +231,7 @@ static int EmuScanEnd16_rot(unsigned int num)
if ((num & 3) != 3)
return 0;
rotated_blit16(g_screen_ptr, rot_buff, num + 1,
!(Pico.video.reg[12] & 1) && !(PicoOpt & POPT_EN_SOFTSCALE));
!(Pico.video.reg[12] & 1) && !(PicoIn.opt & POPT_EN_SOFTSCALE));
return 0;
}
@ -342,7 +342,7 @@ void pemu_finalize_frame(const char *fps, const char *notice)
int emu_opt = currentConfig.EmuOpt;
int ret;
if (PicoAHW & PAHW_32X)
if (PicoIn.AHW & PAHW_32X)
; // nothing to do
else if (get_renderer() == RT_8BIT_FAST)
{
@ -354,11 +354,11 @@ void pemu_finalize_frame(const char *fps, const char *notice)
gp2x_video_setpalette(localPal, ret);
}
// a hack for VR
if (PicoAHW & PAHW_SVP)
if (PicoIn.AHW & PAHW_SVP)
memset32((int *)(Pico.est.Draw2FB+328*8+328*223), 0xe0e0e0e0, 328);
// do actual copy
vidcpyM2(g_screen_ptr, Pico.est.Draw2FB+328*8,
!(Pico.video.reg[12] & 1), !(PicoOpt & POPT_DIS_32C_BORDER));
!(Pico.video.reg[12] & 1), !(PicoIn.opt & POPT_DIS_32C_BORDER));
}
else if (get_renderer() == RT_8BIT_ACC)
{
@ -375,9 +375,9 @@ void pemu_finalize_frame(const char *fps, const char *notice)
osd_text(4, osd_y, notice);
if (emu_opt & EOPT_SHOW_FPS)
osd_text(osd_fps_x, osd_y, fps);
if ((PicoAHW & PAHW_MCD) && (emu_opt & EOPT_EN_CD_LEDS))
if ((PicoIn.AHW & PAHW_MCD) && (emu_opt & EOPT_EN_CD_LEDS))
draw_cd_leds();
if (PicoAHW & PAHW_PICO)
if (PicoIn.AHW & PAHW_PICO)
draw_pico_ptr();
}
@ -472,7 +472,7 @@ static void vid_reset_mode(void)
int gp2x_mode = 16;
int renderer = get_renderer();
PicoOpt &= ~POPT_ALT_RENDERER;
PicoIn.opt &= ~POPT_ALT_RENDERER;
emu_scan_begin = NULL;
emu_scan_end = NULL;
@ -487,7 +487,7 @@ static void vid_reset_mode(void)
gp2x_mode = 8;
break;
case RT_8BIT_FAST:
PicoOpt |= POPT_ALT_RENDERER;
PicoIn.opt |= POPT_ALT_RENDERER;
PicoDrawSetOutFormat(PDF_NONE, 0);
vidcpyM2 = vidcpy_m2;
gp2x_mode = 8;
@ -497,7 +497,7 @@ static void vid_reset_mode(void)
break;
}
if (PicoAHW & PAHW_32X) {
if (PicoIn.AHW & PAHW_32X) {
// Wiz 16bit is an exception, uses line rendering due to rotation mess
if (renderer == RT_16BIT && (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX)) {
PicoDrawSetOutFormat(PDF_RGB555, 1);
@ -510,7 +510,7 @@ static void vid_reset_mode(void)
}
if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) {
if ((PicoAHW & PAHW_32X) || renderer == RT_16BIT) {
if ((PicoIn.AHW & PAHW_32X) || renderer == RT_16BIT) {
emu_scan_begin = EmuScanBegin16_rot;
emu_scan_end = EmuScanEnd16_rot;
}
@ -549,12 +549,12 @@ static void vid_reset_mode(void)
Pico.m.dirtyPal = 1;
PicoOpt &= ~POPT_EN_SOFTSCALE;
PicoIn.opt &= ~POPT_EN_SOFTSCALE;
if (currentConfig.scaling == EOPT_SCALE_SW)
PicoOpt |= POPT_EN_SOFTSCALE;
PicoIn.opt |= POPT_EN_SOFTSCALE;
// palette converters for 8bit modes
make_local_pal = (PicoAHW & PAHW_SMS) ? make_local_pal_sms : make_local_pal_md;
make_local_pal = (PicoIn.AHW & PAHW_SMS) ? make_local_pal_sms : make_local_pal_md;
}
void emu_video_mode_change(int start_line, int line_count, int is_32cols)
@ -569,10 +569,10 @@ void emu_video_mode_change(int start_line, int line_count, int is_32cols)
osd_y = 232;
/* set up hwscaling here */
PicoOpt &= ~POPT_DIS_32C_BORDER;
PicoIn.opt &= ~POPT_DIS_32C_BORDER;
if (is_32cols && currentConfig.scaling == EOPT_SCALE_HW) {
scalex = 256;
PicoOpt |= POPT_DIS_32C_BORDER;
PicoIn.opt |= POPT_DIS_32C_BORDER;
osd_fps_x = OSD_FPS_X - 64;
}
@ -607,7 +607,7 @@ void plat_video_toggle_renderer(int change, int is_menu_call)
vid_reset_mode();
rendstatus_old = -1;
if (PicoAHW & PAHW_32X)
if (PicoIn.AHW & PAHW_32X)
emu_status_msg(renderer_names32x[get_renderer()]);
else
emu_status_msg(renderer_names[get_renderer()]);
@ -626,7 +626,7 @@ static void RunEventsPico(unsigned int events)
if (ret > 35000)
{
if (pdown_frames++ > 5)
PicoPad[0] |= 0x20;
PicoIn.pad[0] |= 0x20;
pico_pen_x = px;
pico_pen_y = py;
@ -654,7 +654,7 @@ void plat_update_volume(int has_changed, int is_up)
gp2x_soc_t soc;
soc = soc_detect();
if ((PicoOpt & POPT_EN_STEREO) && soc == SOCID_MMSP2)
if ((PicoIn.opt & POPT_EN_STEREO) && soc == SOCID_MMSP2)
need_low_volume = 1;
if (has_changed)

View file

@ -13,7 +13,7 @@ const char *men_scaling_opts[] = { "OFF", "software", "hardware", NULL };
mee_onoff ("Vsync", MA_OPT2_VSYNC, currentConfig.EmuOpt, EOPT_VSYNC),
#define MENU_OPTIONS_ADV \
mee_onoff ("Use second CPU for sound", MA_OPT_ARM940_SOUND, PicoOpt, POPT_EXT_FM), \
mee_onoff ("Use second CPU for sound", MA_OPT_ARM940_SOUND, PicoIn.opt, POPT_EXT_FM), \
static menu_entry e_menu_adv_options[];