Skip to content

Commit

Permalink
Merge branch 'dev' into rcheevos
Browse files Browse the repository at this point in the history
  • Loading branch information
OFFTKP committed Aug 9, 2024
2 parents 81830e4 + 555bd38 commit f58b87d
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 33 deletions.
12 changes: 6 additions & 6 deletions src/arm7.h
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ static FORCE_INLINE void arm7_half_word_transfer(arm7_t* cpu, uint32_t opcode){
if(P) addr += increment;
// Store before writeback
if(L==0){
uint32_t data = arm7_reg_read(cpu,Rd);
uint32_t data = arm7_reg_read_r15_adj(cpu,Rd,8);
if(H==1)cpu->write16(cpu->user_data,addr,data);
else cpu->write8(cpu->user_data,addr,data);
}
Expand Down Expand Up @@ -2074,7 +2074,7 @@ static FORCE_INLINE void arm7t_imm_off_ldst(arm7_t* cpu, uint32_t opcode){
if(!B)offset*=4;
addr += offset;
if(L==0){ // Store
uint32_t data = arm7_reg_read(cpu,Rd);
uint32_t data = arm7_reg_read_r15_adj(cpu,Rd,8);
if(B==1)cpu->write8(cpu->user_data,addr,data);
else cpu->write32(cpu->user_data,addr,data);
}else{ // Load
Expand All @@ -2095,7 +2095,7 @@ static FORCE_INLINE void arm9t_imm_off_ldst(arm7_t* cpu, uint32_t opcode){
if(!B)offset*=4;
addr += offset;
if(L==0){ // Store
uint32_t data = arm7_reg_read(cpu,Rd);
uint32_t data = arm7_reg_read_r15_adj(cpu,Rd,8);
if(B==1)cpu->write8(cpu->user_data,addr,data);
else cpu->write32(cpu->user_data,addr,data);
}else{ // Load
Expand All @@ -2115,7 +2115,7 @@ static FORCE_INLINE void arm7t_imm_off_ldst_bh(arm7_t* cpu, uint32_t opcode){
addr += offset*2;
uint32_t data=0;
if(L==0){ // Store
data = arm7_reg_read(cpu,Rd);
data = arm7_reg_read_r15_adj(cpu,Rd,8);
cpu->write16(cpu->user_data,addr,data);
}else{ // Load
data = arm7_rotr(cpu->read16(cpu->user_data,addr),(addr&0x1)*8);
Expand All @@ -2132,7 +2132,7 @@ static FORCE_INLINE void arm7t_stack_off_ldst(arm7_t* cpu, uint32_t opcode){
addr += offset*4;
uint32_t data;
if(L==0){ // Store
data = arm7_reg_read(cpu,Rd);
data = arm7_reg_read_r15_adj(cpu,Rd,8);
cpu->write32(cpu->user_data,addr,data);
}else{ // Load
data = arm7_rotr(cpu->read32(cpu->user_data,addr),(addr&0x3)*8);
Expand All @@ -2149,7 +2149,7 @@ static FORCE_INLINE void arm9t_stack_off_ldst(arm7_t* cpu, uint32_t opcode){
addr += offset*4;
uint32_t data;
if(L==0){ // Store
data = arm7_reg_read(cpu,Rd);
data = arm7_reg_read_r15_adj(cpu,Rd,8);
cpu->write32(cpu->user_data,addr,data);
}else{ // Load
data = arm7_rotr(cpu->read32(cpu->user_data,addr),(addr&0x3)*8);
Expand Down
40 changes: 20 additions & 20 deletions src/gba_bios.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Cult-of-GBA replacement bios //
// License: MIT //
// Authors: DenSinH, Fleroviux, Sky //
// Source: https://github.com/Cult-of-GBA/BIOS/commit/ //
// Commit-Hash: 7294810c9220a80e7d1be1a8d63c6fe3eaba32db //
// Source: https://github.com/Cult-of-GBA/BIOS/ //
// Commit-Hash: 0d9dd3e6283896eab340522d51234799d5c46626 //
////////////////////////////////////////////////////////////////////////
static const unsigned char gba_bios_bin[] = {
0x06, 0x00, 0x00, 0xea, 0x5a, 0x00, 0x00, 0xea, 0x46, 0x00, 0x00, 0xea,
Expand Down Expand Up @@ -239,8 +239,8 @@ static const unsigned char gba_bios_bin[] = {
0x6c, 0xed, 0xef, 0xee, 0x74, 0xf0, 0xfb, 0xf1, 0x84, 0xf3, 0x0f, 0xf5,
0x9c, 0xf6, 0x2b, 0xf8, 0xbb, 0xf9, 0x4b, 0xfb, 0xdd, 0xfc, 0x6e, 0xfe,
0xf0, 0x1b, 0x2d, 0xe9, 0x98, 0xc5, 0x9f, 0xe5, 0x00, 0xb0, 0xa0, 0xe3,
0x01, 0x20, 0x52, 0xe2, 0x16, 0x00, 0x00, 0x4a, 0xf2, 0x40, 0xd0, 0xe0,
0xf2, 0x60, 0xd0, 0xe0, 0xb2, 0x70, 0xd0, 0xe0, 0x27, 0x74, 0xa0, 0xe1,
0x01, 0x20, 0x52, 0xe2, 0x16, 0x00, 0x00, 0xba, 0xf2, 0x40, 0xd0, 0xe0,
0xf2, 0x60, 0xd0, 0xe0, 0xb4, 0x70, 0xd0, 0xe0, 0x27, 0x74, 0xa0, 0xe1,
0x87, 0x80, 0xa0, 0xe1, 0x40, 0x90, 0x87, 0xe2, 0xff, 0x90, 0x09, 0xe2,
0x89, 0x90, 0xa0, 0xe1, 0xf8, 0x80, 0x9c, 0xe1, 0xf9, 0x90, 0x9c, 0xe1,
0x94, 0x08, 0x05, 0xe0, 0x45, 0x57, 0x4b, 0xe0, 0x99, 0x04, 0x04, 0xe0,
Expand All @@ -249,7 +249,7 @@ static const unsigned char gba_bios_bin[] = {
0xb3, 0x50, 0x81, 0xe0, 0xb3, 0x60, 0x81, 0xe0, 0xb3, 0x70, 0x81, 0xe0,
0xe6, 0xff, 0xff, 0xea, 0xf0, 0x1b, 0xbd, 0xe8, 0x1e, 0xff, 0x2f, 0xe1,
0xf8, 0x1f, 0x2d, 0xe9, 0x20, 0xc5, 0x9f, 0xe5, 0x01, 0x20, 0x52, 0xe2,
0x22, 0x00, 0x00, 0x4a, 0x00, 0x0e, 0xb0, 0xe8, 0xf2, 0x30, 0xd0, 0xe0,
0x22, 0x00, 0x00, 0xba, 0x00, 0x0e, 0xb0, 0xe8, 0xf2, 0x30, 0xd0, 0xe0,
0xf2, 0x50, 0xd0, 0xe0, 0xb4, 0x60, 0xd0, 0xe0, 0x26, 0x64, 0xa0, 0xe1,
0x86, 0x70, 0xa0, 0xe1, 0x40, 0x80, 0x86, 0xe2, 0xff, 0x80, 0x08, 0xe2,
0x88, 0x80, 0xa0, 0xe1, 0xf7, 0x70, 0x9c, 0xe1, 0xf8, 0x80, 0x9c, 0xe1,
Expand Down Expand Up @@ -877,7 +877,7 @@ static const unsigned char gba_bios_bin[] = {
0x80, 0x7f, 0x01, 0x06, 0x00, 0x40, 0x00, 0x06, 0x11, 0x11, 0x11, 0x11,
0xc0, 0x24, 0x00, 0x00, 0x40, 0x27, 0x00, 0x00, 0x50, 0x27, 0x00, 0x00,
0x60, 0x23, 0x00, 0x00, 0x60, 0x27, 0x00, 0x00, 0x01, 0x10, 0x5b, 0xe5,
0x00, 0x30, 0xa0, 0xe3, 0x03, 0x20, 0xdb, 0xe7, 0x3a, 0x00, 0x00, 0xeb,
0x00, 0x30, 0xa0, 0xe3, 0x03, 0x20, 0xdb, 0xe7, 0x3b, 0x00, 0x00, 0xeb,
0x82, 0x50, 0x6a, 0xe0, 0xf5, 0x50, 0x9c, 0xe1, 0x45, 0x04, 0x80, 0xe0,
0xff, 0x50, 0x05, 0xe2, 0x05, 0x00, 0x80, 0xe0, 0x01, 0x30, 0x83, 0xe2,
0x04, 0x00, 0x53, 0xe1, 0xf5, 0xff, 0xff, 0xba, 0x6c, 0x30, 0x9f, 0xe5,
Expand All @@ -891,21 +891,21 @@ static const unsigned char gba_bios_bin[] = {
0x01, 0x10, 0x81, 0xe2, 0x01, 0x20, 0x52, 0xe2, 0xfb, 0xff, 0xff, 0xca,
0x20, 0x00, 0x80, 0xe2, 0x01, 0x30, 0x53, 0xe2, 0xf7, 0xff, 0xff, 0xca,
0x02, 0x00, 0x00, 0xea, 0xe0, 0x03, 0x00, 0x07, 0xfc, 0x17, 0x00, 0x00,
0x8e, 0x03, 0x00, 0x06, 0xf0, 0x80, 0xa0, 0xe3, 0x38, 0xa0, 0x9f, 0xe5,
0x8e, 0x03, 0x00, 0x06, 0xf0, 0x80, 0xa0, 0xe3, 0x3c, 0xa0, 0x9f, 0xe5,
0x01, 0xb0, 0xa0, 0xe3, 0xb2, 0xb0, 0xca, 0xe0, 0x99, 0xf8, 0xff, 0xeb,
0xb0, 0xb0, 0xca, 0xe1, 0x28, 0x30, 0x9f, 0xe5, 0x04, 0x40, 0xa0, 0xe3,
0xb0, 0x10, 0xd3, 0xe1, 0x04, 0x10, 0x81, 0xe2, 0xb8, 0x10, 0xc3, 0xe0,
0x01, 0x40, 0x54, 0xe2, 0xfa, 0xff, 0xff, 0xca, 0x04, 0x80, 0x58, 0xe2,
0xf4, 0xff, 0xff, 0xca, 0x00, 0x40, 0xbd, 0xe8, 0x1e, 0xff, 0x2f, 0xe1,
0x00, 0x02, 0x00, 0x04, 0xe2, 0x03, 0x00, 0x07, 0x0f, 0x40, 0x2d, 0xe9,
0x03, 0x00, 0x2d, 0xe9, 0x02, 0x04, 0xa0, 0xe3, 0x20, 0x20, 0x42, 0xe2,
0x82, 0x03, 0x80, 0xe0, 0x34, 0x10, 0x9f, 0xe5, 0x83, 0x14, 0x81, 0xe0,
0x30, 0x20, 0x9f, 0xe5, 0x97, 0xf6, 0xff, 0xeb, 0x03, 0x00, 0xbd, 0xe8,
0x07, 0x24, 0xa0, 0xe3, 0x83, 0x21, 0x82, 0xe0, 0x02, 0x1b, 0x81, 0xe3,
0xb2, 0x10, 0xc2, 0xe0, 0x02, 0x09, 0x80, 0xe3, 0xb2, 0x00, 0xc2, 0xe0,
0x03, 0x32, 0xa0, 0xe1, 0xb2, 0x30, 0xc2, 0xe0, 0x0f, 0x40, 0xbd, 0xe8,
0x1e, 0xff, 0x2f, 0xe1, 0x00, 0x00, 0x01, 0x06, 0x50, 0x23, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0xb0, 0xa0, 0xe3, 0xb0, 0xb0, 0xca, 0xe1, 0x28, 0x30, 0x9f, 0xe5,
0x04, 0x40, 0xa0, 0xe3, 0xb0, 0x10, 0xd3, 0xe1, 0x04, 0x10, 0x81, 0xe2,
0xb8, 0x10, 0xc3, 0xe0, 0x01, 0x40, 0x54, 0xe2, 0xfa, 0xff, 0xff, 0xca,
0x04, 0x80, 0x58, 0xe2, 0xf3, 0xff, 0xff, 0xca, 0x00, 0x40, 0xbd, 0xe8,
0x1e, 0xff, 0x2f, 0xe1, 0x00, 0x02, 0x00, 0x04, 0xe2, 0x03, 0x00, 0x07,
0x0f, 0x40, 0x2d, 0xe9, 0x03, 0x00, 0x2d, 0xe9, 0x02, 0x04, 0xa0, 0xe3,
0x20, 0x20, 0x42, 0xe2, 0x82, 0x03, 0x80, 0xe0, 0x34, 0x10, 0x9f, 0xe5,
0x83, 0x14, 0x81, 0xe0, 0x30, 0x20, 0x9f, 0xe5, 0x96, 0xf6, 0xff, 0xeb,
0x03, 0x00, 0xbd, 0xe8, 0x07, 0x24, 0xa0, 0xe3, 0x83, 0x21, 0x82, 0xe0,
0x02, 0x1b, 0x81, 0xe3, 0xb2, 0x10, 0xc2, 0xe0, 0x02, 0x09, 0x80, 0xe3,
0xb2, 0x00, 0xc2, 0xe0, 0x03, 0x32, 0xa0, 0xe1, 0xb2, 0x30, 0xc2, 0xe0,
0x0f, 0x40, 0xbd, 0xe8, 0x1e, 0xff, 0x2f, 0xe1, 0x00, 0x00, 0x01, 0x06,
0x50, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down
1 change: 1 addition & 0 deletions src/localization.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
// - "Fast Forward"
// - "Save File"
// - ICON_FK_CROSSHAIRS " Located Files"
// - "GUI Scale"

// Strings removed in v4:
// - "Controller"
Expand Down
39 changes: 32 additions & 7 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ typedef struct{
uint32_t avoid_overlaping_touchscreen;
float custom_font_scale;
ra_config_t ra_config;
uint32_t padding[227];
float gui_scale_factor;
uint32_t padding[226];
}persistent_settings_t;
_Static_assert(sizeof(persistent_settings_t)==1024, "persistent_settings_t must be exactly 1024 bytes");
#define SE_STATS_GRAPH_DATA 256
Expand Down Expand Up @@ -566,14 +567,14 @@ float se_android_get_display_dpi_scale();
static float se_dpi_scale(){
if(gui_state.dpi_override)return gui_state.dpi_override/120.;
static float dpi_scale = -1.0;
if(dpi_scale>0.)return dpi_scale;
if(dpi_scale>0.)return dpi_scale*gui_state.settings.gui_scale_factor;
dpi_scale = sapp_dpi_scale();
if(dpi_scale<=0)dpi_scale=1.;
dpi_scale*=1.10;
#ifdef SE_PLATFORM_ANDROID
dpi_scale = se_android_get_display_dpi_scale();
#endif
return dpi_scale;
return dpi_scale*gui_state.settings.gui_scale_factor;
}

static void se_cache_glyphs(const char* input_string){
Expand Down Expand Up @@ -2678,7 +2679,9 @@ static void se_draw_emulated_system_screen(bool preview){
bool portrait = scr_w<scr_h;
ImVec2 win_pos;
igGetWindowPos(&win_pos);
if(!se_draw_theme_region(portrait?SE_REGION_BEZEL_PORTRAIT:SE_REGION_BEZEL_LANDSCAPE, win_pos.x,win_pos.y,scr_w/se_dpi_scale(),scr_h/se_dpi_scale())){
if(se_draw_theme_region(portrait?SE_REGION_BEZEL_PORTRAIT:SE_REGION_BEZEL_LANDSCAPE, win_pos.x,win_pos.y,scr_w/se_dpi_scale(),scr_h/se_dpi_scale()))/*do nothing*/;
else if(se_draw_theme_region(SE_REGION_BEZEL_LANDSCAPE, win_pos.x,win_pos.y,scr_w/se_dpi_scale(),scr_h/se_dpi_scale())) /*do nothing*/;
else{
ImVec2 v;
igGetWindowPos(&v);
lcd_render_x+=v.x*dpi_scale+scr_w*0.5;
Expand Down Expand Up @@ -5962,7 +5965,7 @@ void se_draw_menu_panel(){
se_bios_info_t * info = &gui_state.bios_info;
if(emu_state.rom_loaded){
se_section(ICON_FK_CROSSHAIRS " Located Files");
const char* wildcard_types[]={NULL};
static const char* wildcard_types[]={NULL};
if(sb_file_exists(emu_state.save_file_path)){
igPushStyleColorU32(ImGuiCol_Text,0xff00ff00);
se_text(ICON_FK_CHECK);
Expand Down Expand Up @@ -6103,15 +6106,15 @@ void se_draw_menu_panel(){
bool load = se_combo_str("##Theme",&theme,"Dark\0Light\0Black\0Custom\0",0);
igPopItemWidth();
if(gui_state.settings.theme==SE_THEME_CUSTOM){
const char *types[]={"*.png",NULL};
static const char *types[]={"*.png",NULL};
load|= se_input_file("Theme Path", gui_state.paths.theme,types,ImGuiInputTextFlags_None);
load|= strncmp(gui_state.loaded_theme_path,gui_state.paths.theme,SB_FILE_PATH_SIZE)!=0;
if(load){
if(se_load_theme_from_file(gui_state.paths.theme))
se_save_search_paths();
}
load=false;
const char *font_types[]={"*.ttf",NULL};
static const char *font_types[]={"*.ttf",NULL};

load|= se_input_file("Custom Font", gui_state.paths.custom_font,font_types,ImGuiInputTextFlags_None);
load|= strncmp(gui_state.loaded_custom_font_path,gui_state.paths.custom_font,SB_FILE_PATH_SIZE)!=0;
Expand Down Expand Up @@ -6154,6 +6157,25 @@ void se_draw_menu_panel(){
}

gui_state.settings.theme = theme;

{
se_text("GUI Scale");igSameLine(SE_FIELD_INDENT,0);
static double last_edit_time = 0;
static float curr_slider_scale = -1;
if(curr_slider_scale<0)curr_slider_scale = gui_state.settings.gui_scale_factor;
float last_slider_scale = curr_slider_scale;
igPushItemWidth(-1);
se_slider_float("##GUI Scale",&curr_slider_scale,0.5,2.5,"Scale: %0.2fx");
igPopItemWidth();
// Changing the GUI scale factor requires reseting the entire GUI, so wait for a little over
// a second after the user stops making changes to set the new scale factor
if(last_slider_scale!=curr_slider_scale){
last_edit_time = se_time();
}
if(se_time()-last_edit_time>1.5)gui_state.settings.gui_scale_factor=curr_slider_scale;
}


bool always_show_menubar = gui_state.settings.always_show_menubar;
se_checkbox("Always Show Menu/Nav Bar",&always_show_menubar);
gui_state.settings.always_show_menubar = always_show_menubar;
Expand Down Expand Up @@ -7203,13 +7225,16 @@ void se_load_settings(){
gui_state.settings.avoid_overlaping_touchscreen = true;
}
if(gui_state.settings.settings_file_version<3){
gui_state.settings.gui_scale_factor = 1.0;
gui_state.settings.settings_file_version = 3;
gui_state.settings.ra_config.hardcore_mode=1;
gui_state.settings.ra_config.draw_challenge_indicators=1;
gui_state.settings.ra_config.draw_progress_indicators=1;
gui_state.settings.ra_config.draw_leaderboard_trackers=1;
gui_state.settings.ra_config.draw_notifications=1;
}
if(gui_state.settings.gui_scale_factor<0.5)gui_state.settings.gui_scale_factor=1.0;
if(gui_state.settings.gui_scale_factor>4.0)gui_state.settings.gui_scale_factor=1.0;
if(gui_state.settings.custom_font_scale<0.5)gui_state.settings.custom_font_scale=1.0;
if(gui_state.settings.custom_font_scale>2.0)gui_state.settings.custom_font_scale=1.0;
if(gui_state.settings.touch_controls_scale<0.1)gui_state.settings.touch_controls_scale=1.0;
Expand Down

0 comments on commit f58b87d

Please sign in to comment.