diff --git a/Source/Glide64/Combine.cpp b/Source/Glide64/Combine.cpp index 6d91a83e5..0cfc874e3 100644 --- a/Source/Glide64/Combine.cpp +++ b/Source/Glide64/Combine.cpp @@ -8135,8 +8135,7 @@ static void cc__t0_inter_t1_using_primlod__mul_shade() cc_t0_mul_shade(); return; } - //*/ - if (g_settings->ucode == 7) + if (g_settings->ucode() == CSettings::ucode_PerfectDark) lod_frac = rdp.prim_lodfrac; CCMB(GR_COMBINE_FUNCTION_SCALE_OTHER, GR_COMBINE_FACTOR_LOCAL, diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index a77f002df..5032abef9 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -1249,7 +1249,7 @@ void CALL RomOpen(void) WriteTrace(TraceGlide64, TraceDebug, "-"); no_dlist = true; g_romopen = TRUE; - ucode_error_report = TRUE; // allowed to report ucode errors + g_ucode_error_report = TRUE; // allowed to report ucode errors rdp_reset(); // Get the country code & translate to NTSC(0) or PAL(1) @@ -1697,7 +1697,7 @@ void newSwapBuffers() } } - if (g_settings->wireframe || g_settings->buff_clear || (g_settings->hacks(CSettings::hack_PPL) && g_settings->ucode == 6)) + if (g_settings->wireframe || g_settings->buff_clear || (g_settings->hacks(CSettings::hack_PPL) && g_settings->ucode() == CSettings::ucode_S2DEX)) { grDepthMask((g_settings->hacks(CSettings::hack_RE2) && g_settings->fb_depth_render_enabled()) ? FXFALSE : FXTRUE); grBufferClear(0, 0, 0xFFFF); diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 96b9e9518..fbb231b8d 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -1,3 +1,4 @@ +#include #include "Gfx_1.3.h" #include "SettingsID.h" @@ -51,7 +52,7 @@ ghq_cache_size(0), ghq_hirs_let_texartists_fly(0), ghq_hirs_dump(0), autodetect_ucode(0), -ucode(0), + m_ucode(ucode_Fast3D), unk_as_red(0), unk_clear(0), wireframe(0), @@ -123,7 +124,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_Rotate, "rotate", Rotate_None); general_setting(Set_wrpAnisotropic, "wrpAnisotropic", 0); general_setting(Set_autodetect_ucode, "autodetect_ucode", 1); - general_setting(Set_ucode, "ucode", 2); + general_setting(Set_ucode, "ucode", ucode_F3DEX2); general_setting(Set_wireframe, "wireframe", 0); general_setting(Set_wfmode, "wfmode", 1); general_setting(Set_unk_as_red, "unk_as_red", 0); @@ -271,6 +272,26 @@ void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove) } } +CSettings::ucode_t CSettings::DetectUCode(uint32_t uc_crc) +{ + RegisterSetting(Set_ucodeLookup, Data_DWORD_RDB_Setting, stdstr_f("%08lx", uc_crc).c_str(), "ucode", (unsigned int)-2, NULL); + CSettings::ucode_t uc = (CSettings::ucode_t)GetSetting(Set_ucodeLookup); + if (uc == CSettings::uCode_NotFound || uc == CSettings::uCode_Unsupported) + { + m_ucode = (CSettings::ucode_t)GetSetting(Set_ucode); + } + else + { + m_ucode = uc; + } + return uc; +} + +void CSettings::SetUcode(ucode_t value) +{ + m_ucode = value; +} + void CSettings::UpdateAspectRatio(void) { switch (m_aspectmode) @@ -325,19 +346,18 @@ void CSettings::ReadSettings() #ifndef _ENDUSER_RELEASE_ this->autodetect_ucode = GetSetting(Set_autodetect_ucode); - this->ucode = GetSetting(Set_ucode); this->wireframe = GetSetting(Set_wireframe); this->wfmode = GetSetting(Set_wfmode); this->unk_as_red = GetSetting(Set_unk_as_red); this->unk_clear = GetSetting(Set_unk_clear); #else this->autodetect_ucode = TRUE; - this->ucode = 2; this->wireframe = FALSE; this->wfmode = 0; this->unk_as_red = FALSE; this->unk_clear = FALSE; #endif + m_ucode = ucode_F3DEX2; char texture_dir[260]; memset(texture_dir, 0, sizeof(texture_dir)); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 690c201ec..0a508f3e4 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -127,6 +127,23 @@ public: STIPPLE_Rotate = 0x2, }; + enum ucode_t + { + uCode_NotFound = -2, + uCode_Unsupported = -1, + ucode_Fast3D = 0, + ucode_F3DEX = 1, + ucode_F3DEX2 = 2, + ucode_WaveRace = 3, + ucode_StarWars = 4, + ucode_DiddyKong = 5, + ucode_S2DEX = 6, + ucode_PerfectDark = 7, + ucode_CBFD = 8, + ucode_zSort = 9, + ucode_Turbo3d = 21, + }; + uint32_t res_x, scr_res_x; uint32_t res_y, scr_res_y; #ifndef ANDROID @@ -200,7 +217,7 @@ public: //Debug int autodetect_ucode; - int ucode; + inline ucode_t ucode(void) const { return m_ucode; } int unk_as_red; int unk_clear; int wireframe; @@ -246,6 +263,8 @@ public: void SetGhqFltr(TextureFilter_t value); void SetGhqEnht(TextureEnhancement_t value); void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); + ucode_t DetectUCode(uint32_t uc_crc); + void SetUcode(ucode_t value); void ReadGameSettings(const char * name); void WriteSettings(void); @@ -267,6 +286,7 @@ private: PixelLevelOfDetail_t m_lodmode; TextureFilter_t m_ghq_fltr; TextureEnhancement_t m_ghq_enht; + ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; }; diff --git a/Source/Glide64/Util.cpp b/Source/Glide64/Util.cpp index a710b2e17..0183aacf2 100644 --- a/Source/Glide64/Util.cpp +++ b/Source/Glide64/Util.cpp @@ -1799,7 +1799,7 @@ void update() grDepthBufferFunction(g_settings->zmode_compare_less ? GR_CMP_LESS : GR_CMP_LEQUAL); break; case 2: - grDepthBiasLevel(g_settings->ucode == 7 ? -4 : 0); + grDepthBiasLevel(g_settings->ucode() == CSettings::ucode_PerfectDark ? -4 : 0); grDepthBufferFunction(GR_CMP_LESS); break; case 3: diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index 25741125b..6ff0b2fde 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -148,7 +148,7 @@ char out_buf[2048]; uint32_t frame_count; // frame counter -int ucode_error_report = TRUE; +bool g_ucode_error_report = TRUE; int wrong_tile = -1; // ** RDP graphics functions ** @@ -222,7 +222,7 @@ void microcheck(); #include "turbo3D.h" static int reset = 0; -static int old_ucode = -1; +static CSettings::ucode_t g_old_ucode = CSettings::uCode_Unsupported; void RDP::Reset() { @@ -315,41 +315,36 @@ void microcheck() ucf.close(); #endif + g_old_ucode = g_settings->ucode(); WriteTrace(TraceRDP, TraceDebug, "ucode = %08lx", uc_crc); - - RegisterSetting(Set_ucodeLookup, Data_DWORD_RDB_Setting, stdstr_f("%08lx", uc_crc).c_str(), "ucode", (unsigned int)-2, NULL); - int uc = GetSetting(Set_ucodeLookup); - - if (uc == -2 && ucode_error_report) + CSettings::ucode_t uc = g_settings->DetectUCode(uc_crc); + if (uc == CSettings::uCode_NotFound) { - g_settings->ucode = GetSetting(Set_ucode); - - ReleaseGfx(); - WriteTrace(TraceGlide64, TraceError, "uCode crc not found in INI, using currently selected uCode %08lx", (unsigned long)uc_crc); + if (g_ucode_error_report) + { + ReleaseGfx(); + WriteTrace(TraceGlide64, TraceError, "uCode crc not found in INI, using currently selected uCode %08lx", (unsigned long)uc_crc); #ifdef _WIN32 - MessageBox(gfx.hWnd, stdstr_f("Error: uCode crc not found in INI, using currently selected uCode\n\n%08lx", uc_crc).c_str(), "Error", MB_OK | MB_ICONEXCLAMATION); + MessageBox(gfx.hWnd, stdstr_f("Error: uCode crc not found in INI, using currently selected uCode\n\n%08lx", uc_crc).c_str(), "Error", MB_OK | MB_ICONEXCLAMATION); #endif - - ucode_error_report = FALSE; // don't report any more ucode errors from this game + g_ucode_error_report = false; // don't report any more ucode errors from this game + } } - else if (uc == -1 && ucode_error_report) + else if (uc == CSettings::uCode_Unsupported) { - g_settings->ucode = GetSetting(Set_ucode); - - ReleaseGfx(); - WriteTrace(TraceGlide64, TraceError, "Unsupported uCode! crc: %08lx", (unsigned long)uc_crc); - + if (g_ucode_error_report) + { + ReleaseGfx(); + WriteTrace(TraceGlide64, TraceError, "Unsupported uCode! crc: %08lx", (unsigned long)uc_crc); #ifdef _WIN32 - MessageBox(gfx.hWnd, stdstr_f("Error: Unsupported uCode!\n\ncrc: %08lx", uc_crc).c_str(), "Error", MB_OK | MB_ICONEXCLAMATION); + MessageBox(gfx.hWnd, stdstr_f("Error: Unsupported uCode!\n\ncrc: %08lx", uc_crc).c_str(), "Error", MB_OK | MB_ICONEXCLAMATION); #endif - - ucode_error_report = FALSE; // don't report any more ucode errors from this game + g_ucode_error_report = FALSE; // don't report any more ucode errors from this game + } } else { - old_ucode = g_settings->ucode; - g_settings->ucode = uc; - WriteTrace(TraceRDP, TraceDebug, "microcheck: old ucode: %d, new ucode: %d", old_ucode, uc); + WriteTrace(TraceRDP, TraceDebug, "microcheck: old ucode: %d, new ucode: %d", g_old_ucode, uc); if (uc_crc == 0x8d5735b2 || uc_crc == 0xb1821ed3 || uc_crc == 0x1118b3e0) //F3DLP.Rej ucode. perspective texture correction is not implemented { rdp.Persp_en = 1; @@ -591,7 +586,7 @@ EXPORT void CALL ProcessDList(void) else memset(microcode, 0, 4096); } - else if (((old_ucode == ucode_S2DEX) && (g_settings->ucode == ucode_F3DEX)) || g_settings->force_microcheck) + else if ((g_old_ucode == CSettings::ucode_S2DEX && g_settings->ucode() == CSettings::ucode_F3DEX) || g_settings->force_microcheck) { uint32_t startUcode = *(uint32_t*)(gfx.DMEM + 0xFD0); memcpy(microcode, gfx.RDRAM + startUcode, 4096); @@ -599,11 +594,15 @@ EXPORT void CALL ProcessDList(void) } if (exception) + { return; + } // Switch to fullscreen? if (to_fullscreen) + { GoToFullScreen(); + } //* Set states *// if (g_settings->swapmode() != CSettings::SwapMode_Old) @@ -656,7 +655,7 @@ EXPORT void CALL ProcessDList(void) // Get the start of the display list and the length of it uint32_t dlist_start = *(uint32_t*)(gfx.DMEM + 0xFF0); uint32_t dlist_length = *(uint32_t*)(gfx.DMEM + 0xFF4); - WriteTrace(TraceRDP, TraceDebug, "--- NEW DLIST --- crc: %08lx, ucode: %d, fbuf: %08lx, fbuf_width: %d, dlist start: %08lx, dlist_length: %d, x_scale: %f, y_scale: %f", uc_crc, g_settings->ucode, *gfx.VI_ORIGIN_REG, *gfx.VI_WIDTH_REG, dlist_start, dlist_length, (*gfx.VI_X_SCALE_REG & 0xFFF) / 1024.0f, (*gfx.VI_Y_SCALE_REG & 0xFFF) / 1024.0f); + WriteTrace(TraceRDP, TraceDebug, "--- NEW DLIST --- crc: %08lx, ucode: %d, fbuf: %08lx, fbuf_width: %d, dlist start: %08lx, dlist_length: %d, x_scale: %f, y_scale: %f", uc_crc, g_settings->ucode(), *gfx.VI_ORIGIN_REG, *gfx.VI_WIDTH_REG, dlist_start, dlist_length, (*gfx.VI_X_SCALE_REG & 0xFFF) / 1024.0f, (*gfx.VI_Y_SCALE_REG & 0xFFF) / 1024.0f); // Do nothing if dlist is empty if (dlist_start == 0) @@ -682,14 +681,15 @@ EXPORT void CALL ProcessDList(void) #ifdef CATCH_EXCEPTIONS try { #endif - if (g_settings->ucode == ucode_Turbo3d) + if (g_settings->ucode() == CSettings::ucode_Turbo3d) { Turbo3D(); } else { // MAIN PROCESSING LOOP - do { + do + { // Get the address of the next command a = rdp.pc[rdp.pc_i] & BMASK; @@ -708,7 +708,7 @@ EXPORT void CALL ProcessDList(void) perf_cur = CDateTime().SetToNow().Value(); #endif // Process this instruction - gfx_instruction[g_settings->ucode][rdp.cmd0 >> 24](); + gfx_instruction[g_settings->ucode()][rdp.cmd0 >> 24](); // check DL counter if (rdp.dl_count != -1) @@ -928,7 +928,7 @@ static void rdp_texrect() rdp.pc[rdp.pc_i] += 8; } } - if (g_settings->hacks(CSettings::hack_Yoshi) && g_settings->ucode == ucode_S2DEX) + if (g_settings->hacks(CSettings::hack_Yoshi) && g_settings->ucode() == CSettings::ucode_S2DEX) { ys_memrect(); return; @@ -947,7 +947,7 @@ static void rdp_texrect() return; } - if ((g_settings->ucode == ucode_CBFD) && rdp.cur_image && rdp.cur_image->format) + if ((g_settings->ucode() == CSettings::ucode_CBFD) && rdp.cur_image && rdp.cur_image->format) { //WriteTrace(TraceRDP, TraceDebug, "Wrong Texrect. texaddr: %08lx, cimg: %08lx, cimg_end: %08lx", rdp.timg.addr, rdp.maincimg[1].addr, rdp.maincimg[1].addr+rdp.ci_width*rdp.ci_height*rdp.ci_size); WriteTrace(TraceRDP, TraceDebug, "Shadow texrect is skipped."); @@ -955,7 +955,7 @@ static void rdp_texrect() return; } - if ((g_settings->ucode == ucode_PerfectDark) && rdp.ci_count > 0 && (rdp.frame_buffers[rdp.ci_count - 1].status == ci_zcopy)) + if ((g_settings->ucode() == CSettings::ucode_PerfectDark) && rdp.ci_count > 0 && (rdp.frame_buffers[rdp.ci_count - 1].status == ci_zcopy)) { pd_zcopy(); WriteTrace(TraceRDP, TraceDebug, "Depth buffer copied."); @@ -1059,7 +1059,7 @@ static void rdp_texrect() //*/ //* //remove motion blur in night vision - if ((g_settings->ucode == ucode_PerfectDark) && (rdp.maincimg[1].addr != rdp.maincimg[0].addr) && (rdp.timg.addr >= rdp.maincimg[1].addr) && (rdp.timg.addr < (rdp.maincimg[1].addr + rdp.ci_width*rdp.ci_height*rdp.ci_size))) + if (g_settings->ucode() == CSettings::ucode_PerfectDark && (rdp.maincimg[1].addr != rdp.maincimg[0].addr) && (rdp.timg.addr >= rdp.maincimg[1].addr) && (rdp.timg.addr < (rdp.maincimg[1].addr + rdp.ci_width*rdp.ci_height*rdp.ci_size))) { if (g_settings->fb_emulation_enabled() && rdp.ci_count > 0 && rdp.frame_buffers[rdp.ci_count - 1].status == ci_copy_self) { @@ -1072,12 +1072,12 @@ static void rdp_texrect() int i; - uint32_t tile = (uint16_t)((rdp.cmd1 & 0x07000000) >> 24); + uint32_t tile_no = (uint16_t)((rdp.cmd1 & 0x07000000) >> 24); rdp.texrecting = 1; uint32_t prev_tile = rdp.cur_tile; - rdp.cur_tile = tile; + rdp.cur_tile = tile_no; const float Z = set_sprite_combine_mode(); @@ -1112,7 +1112,7 @@ static void rdp_texrect() float s_ul_y = ul_y * rdp.scale_y + rdp.offset_y; float s_lr_y = lr_y * rdp.scale_y + rdp.offset_y; - WriteTrace(TraceRDP, TraceDebug, "texrect (%.2f, %.2f, %.2f, %.2f), tile: %d, #%d, #%d", ul_x, ul_y, lr_x, lr_y, tile, rdp.tri_n, rdp.tri_n + 1); + WriteTrace(TraceRDP, TraceDebug, "texrect (%.2f, %.2f, %.2f, %.2f), tile: %d, #%d, #%d", ul_x, ul_y, lr_x, lr_y, tile_no, rdp.tri_n, rdp.tri_n + 1); WriteTrace(TraceRDP, TraceDebug, "(%f, %f) -> (%f, %f), s: (%d, %d) -> (%d, %d)", s_ul_x, s_ul_y, s_lr_x, s_lr_y, rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y); WriteTrace(TraceRDP, TraceDebug, "\toff_x: %f, off_y: %f, dsdx: %f, dtdy: %f", off_x_i / 32.0f, off_y_i / 32.0f, dsdx, dtdy); @@ -1528,17 +1528,17 @@ static void rdp_setothermode() #define F3DEX2_SETOTHERMODE(cmd,sft,len,data) { \ rdp.cmd0 = (uint32_t)((cmd<<24) | ((32-(sft)-(len))<<8) | (((len)-1))); \ rdp.cmd1 = (uint32_t)(data); \ - gfx_instruction[g_settings->ucode][cmd] (); \ + gfx_instruction[g_settings->ucode()][cmd] (); \ } #define SETOTHERMODE(cmd,sft,len,data) { \ rdp.cmd0 = (uint32_t)((cmd<<24) | ((sft)<<8) | (len)); \ rdp.cmd1 = (uint32_t)data; \ - gfx_instruction[g_settings->ucode][cmd] (); \ + gfx_instruction[g_settings->ucode()][cmd] (); \ } WriteTrace(TraceRDP, TraceDebug, "rdp_setothermode"); - if ((g_settings->ucode == ucode_F3DEX2) || (g_settings->ucode == ucode_CBFD)) + if (g_settings->ucode() == CSettings::ucode_F3DEX2 || g_settings->ucode() == CSettings::ucode_CBFD) { int cmd0 = rdp.cmd0; F3DEX2_SETOTHERMODE(0xE2, 0, 32, rdp.cmd1); // SETOTHERMODE_L @@ -2221,7 +2221,7 @@ static void rdp_fillrect() WriteTrace(TraceRDP, TraceDebug, "Fillrect. Wrong coordinates. Skipped"); return; } - int pd_multiplayer = (g_settings->ucode == ucode_PerfectDark) && (rdp.cycle_mode == 3) && (rdp.fill_color == 0xFFFCFFFC); + bool pd_multiplayer = g_settings->ucode() == CSettings::ucode_PerfectDark && rdp.cycle_mode == 3 && rdp.fill_color == 0xFFFCFFFC; if ((rdp.cimg == rdp.zimg) || (g_settings->fb_emulation_enabled() && rdp.ci_count > 0 && rdp.frame_buffers[rdp.ci_count - 1].status == ci_zimg) || pd_multiplayer) { WriteTrace(TraceRDP, TraceDebug, "Fillrect - cleared the depth buffer"); @@ -2737,7 +2737,7 @@ static void rdp_setcolorimage() } break; case ci_zimg: - if (g_settings->ucode != ucode_PerfectDark) + if (g_settings->ucode() != CSettings::ucode_PerfectDark) { if (g_settings->fb_hwfbe_enabled() && !rdp.copy_ci_index && (rdp.copy_zi_index || g_settings->hacks(CSettings::hack_BAR))) { @@ -2751,7 +2751,7 @@ static void rdp_setcolorimage() rdp.skip_drawing = TRUE; break; case ci_zcopy: - if (g_settings->ucode != ucode_PerfectDark) + if (g_settings->ucode() != CSettings::ucode_PerfectDark) { if (g_settings->fb_hwfbe_enabled() && !rdp.copy_ci_index && rdp.copy_zi_index == rdp.ci_count) { @@ -2938,7 +2938,7 @@ static void rdp_setcolorimage() static void rsp_reserved0() { - if (g_settings->ucode == ucode_DiddyKong) + if (g_settings->ucode() == CSettings::ucode_DiddyKong) { ucode5_texshiftaddr = segoffset(rdp.cmd1); ucode5_texshiftcount = 0; @@ -3271,8 +3271,8 @@ void DetectFrameBufferUsage() // Go to the next instruction rdp.pc[rdp.pc_i] = (a + 8) & BMASK; - if (uintptr_t(reinterpret_cast(gfx_instruction_lite[g_settings->ucode][rdp.cmd0 >> 24]))) - gfx_instruction_lite[g_settings->ucode][rdp.cmd0 >> 24](); + if (uintptr_t(reinterpret_cast(gfx_instruction_lite[g_settings->ucode()][rdp.cmd0 >> 24]))) + gfx_instruction_lite[g_settings->ucode()][rdp.cmd0 >> 24](); // check DL counter if (rdp.dl_count != -1) @@ -3366,7 +3366,7 @@ void DetectFrameBufferUsage() { if (g_settings->fb_hwfbe_enabled()) { - if (rdp.read_previous_ci && !previous_ci_was_read && (g_settings->swapmode() != CSettings::SwapMode_Hybrid) && (g_settings->ucode != ucode_PerfectDark)) + if (rdp.read_previous_ci && !previous_ci_was_read && (g_settings->swapmode() != CSettings::SwapMode_Hybrid) && (g_settings->ucode() != CSettings::ucode_PerfectDark)) { int ind = (rdp.ci_count > 0) ? rdp.ci_count - 1 : 0; uint32_t height = rdp.frame_buffers[ind].height; diff --git a/Source/Glide64/rdp.h b/Source/Glide64/rdp.h index bb1544923..c61a2e014 100644 --- a/Source/Glide64/rdp.h +++ b/Source/Glide64/rdp.h @@ -612,7 +612,7 @@ extern uint32_t offset_cursor; extern uint32_t offset_textures; extern uint32_t offset_texbuf1; -extern int ucode_error_report; +extern bool g_ucode_error_report; // RDP functions void rdp_reset(); diff --git a/Source/Glide64/turbo3D.h b/Source/Glide64/turbo3D.h index c1d254a9d..5fb7cc053 100644 --- a/Source/Glide64/turbo3D.h +++ b/Source/Glide64/turbo3D.h @@ -243,9 +243,10 @@ static void t3dLoadObject(uint32_t pstate, uint32_t pvtx, uint32_t ptri) static void Turbo3D() { WriteTrace(TraceRDP, TraceDebug, "Start Turbo3D microcode"); - g_settings->ucode = ucode_Fast3D; + g_settings->SetUcode(CSettings::ucode_Fast3D); uint32_t a = 0, pgstate = 0, pstate = 0, pvtx = 0, ptri = 0; - do { + do + { a = rdp.pc[rdp.pc_i] & BMASK; pgstate = ((uint32_t*)gfx.RDRAM)[a >> 2]; pstate = ((uint32_t*)gfx.RDRAM)[(a >> 2) + 1]; @@ -258,11 +259,12 @@ static void Turbo3D() break; } if (pgstate) + { t3dLoadGlobState(pgstate); + } t3dLoadObject(pstate, pvtx, ptri); // Go to the next instruction rdp.pc[rdp.pc_i] += 16; } while (pstate); - // rdp_fullsync(); - g_settings->ucode = ucode_Turbo3d; + g_settings->SetUcode(CSettings::ucode_Turbo3d); } diff --git a/Source/Glide64/ucode00.h b/Source/Glide64/ucode00.h index a8c60b84d..684f4948e 100644 --- a/Source/Glide64/ucode00.h +++ b/Source/Glide64/ucode00.h @@ -37,18 +37,6 @@ // //**************************************************************** -#define ucode_Fast3D 0 -#define ucode_F3DEX 1 -#define ucode_F3DEX2 2 -#define ucode_WaveRace 3 -#define ucode_StarWars 4 -#define ucode_DiddyKong 5 -#define ucode_S2DEX 6 -#define ucode_PerfectDark 7 -#define ucode_CBFD 8 -#define ucode_zSort 9 -#define ucode_Turbo3d 21 - static void rsp_vertex(int v0, int n) { uint32_t addr = segoffset(rdp.cmd1) & 0x00FFFFFF; @@ -814,7 +802,7 @@ static void uc0_setothermode_h() WriteTrace(TraceRDP, TraceDebug, "uc0:setothermode_h: "); int shift, len; - if ((g_settings->ucode == ucode_F3DEX2) || (g_settings->ucode == ucode_CBFD)) + if (g_settings->ucode() == CSettings::ucode_F3DEX2 || g_settings->ucode() == CSettings::ucode_CBFD) { len = (rdp.cmd0 & 0xFF) + 1; shift = 32 - ((rdp.cmd0 >> 8) & 0xFF) - len; @@ -892,7 +880,7 @@ static void uc0_setothermode_l() WriteTrace(TraceRDP, TraceDebug, "uc0:setothermode_l "); int shift, len; - if ((g_settings->ucode == ucode_F3DEX2) || (g_settings->ucode == ucode_CBFD)) + if (g_settings->ucode() == CSettings::ucode_F3DEX2 || g_settings->ucode() == CSettings::ucode_CBFD) { len = (rdp.cmd0 & 0xFF) + 1; shift = 32 - ((rdp.cmd0 >> 8) & 0xFF) - len; diff --git a/Source/Glide64/ucode06.h b/Source/Glide64/ucode06.h index 34b4a6f52..ea5991784 100644 --- a/Source/Glide64/ucode06.h +++ b/Source/Glide64/ucode06.h @@ -738,7 +738,7 @@ static void uc6_bg(bool bg_1cyc) return; } - if (g_settings->ucode == ucode_F3DEX2 || g_settings->hacks(CSettings::hack_PPL)) + if (g_settings->ucode() == CSettings::ucode_F3DEX2 || g_settings->hacks(CSettings::hack_PPL)) { if ((d.imagePtr != rdp.cimg) && (d.imagePtr != rdp.ocimg) && d.imagePtr) //can't draw from framebuffer DrawImage(d); diff --git a/Source/Glide64/ucode09rdp.h b/Source/Glide64/ucode09rdp.h index 587b55ad5..805593dd5 100644 --- a/Source/Glide64/ucode09rdp.h +++ b/Source/Glide64/ucode09rdp.h @@ -63,7 +63,7 @@ void uc9_rpdcmd() a++; rdp.cmd3 = ((uint32_t*)gfx.RDRAM)[a++]; } - gfx_instruction[ucode_zSort][cmd](); + gfx_instruction[CSettings::ucode_zSort][cmd](); }; rdp.LLE = 0; }