Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions src/gte.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,23 @@ bool checkHotkey(SDL_Keycode key) {
#define EM_BOOL int
#endif

// Force a redraw of the sdl surfaces for vRAM and gRAM
// This is useful when the entire screen needs to be redrawn following a palette swap
void redrawVramGramSurfaces() {
int vramSize = vRAM_Surface->w * vRAM_Surface->h;
int gramSize = gRAM_Surface->w * gRAM_Surface->h;
Uint32 *vramPixels = (Uint32 *)vRAM_Surface->pixels;
Uint32 *gramPixels = (Uint32 *)gRAM_Surface->pixels;

for (int i; i < vramSize; i++) {
vramPixels[i] = Palette::ConvertColor(vRAM_Surface, system_state.vram[i]);
}

for (int i; i < gramSize; i++) {
gramPixels[i] = Palette::ConvertColor(gRAM_Surface, system_state.gram[i]);
}
}

void refreshScreen() {
SDL_Rect src, dest;
int scr_w, scr_h;
Expand Down Expand Up @@ -869,11 +886,13 @@ void refreshScreen() {
ImGui::SliderInt("Volume", &AudioCoprocessor::singleton_acp_state->volume, 0, 256);
ImGui::Checkbox("Mute", &AudioCoprocessor::singleton_acp_state->isMuted);
if(ImGui::BeginMenu("Pallete")) {
ImGui::RadioButton("Unscaled Capture", &palette_select, PALETTE_SELECT_CAPTURE);
ImGui::RadioButton("Full Contrast", &palette_select, PALETTE_SELECT_SCALED);
ImGui::RadioButton("Cheap HDMI converter", &palette_select, PALETTE_SELECT_HDMI);
ImGui::RadioButton("Flawed Theory (Legacy)", &palette_select, PALETTE_SELECT_OLD);
ImGui::EndMenu();
if (ImGui::RadioButton("Unscaled Capture", &palette_select, PALETTE_SELECT_CAPTURE) ||
ImGui::RadioButton("Full Contrast", &palette_select, PALETTE_SELECT_SCALED) ||
ImGui::RadioButton("Cheap HDMI converter", &palette_select, PALETTE_SELECT_HDMI) ||
ImGui::RadioButton("Flawed Theory (Legacy)", &palette_select, PALETTE_SELECT_OLD)) {
redrawVramGramSurfaces();
}
ImGui::EndMenu();
}
ImGui::EndMenu();
}
Expand Down