Skip to content

Commit 96c46ee

Browse files
authored
Merge pull request #26 from allkern/correct-timings
Merge correct-timings work
2 parents df0df85 + 5c1439e commit 96c46ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2699
-1347
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@
1111
[submodule "incbin"]
1212
path = incbin
1313
url = https://github.com/graphitemaster/incbin
14+
[submodule "implot"]
15+
path = implot
16+
url = https://github.com/epezent/implot

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ target_sources(iris PRIVATE
9595
frontend/ui/memory_card_tool.cpp
9696
frontend/ui/menubar.cpp
9797
frontend/ui/modules.cpp
98+
frontend/ui/overlay.cpp
9899
frontend/ui/pad.cpp
99100
frontend/ui/settings.cpp
100101
frontend/ui/spu2.cpp
@@ -171,13 +172,17 @@ target_sources(iris PRIVATE
171172
imgui/imgui_tables.cpp
172173
imgui/imgui_widgets.cpp
173174
imgui/backends/imgui_impl_sdl3.cpp
174-
imgui/backends/imgui_impl_sdlgpu3.cpp)
175+
imgui/backends/imgui_impl_sdlgpu3.cpp
176+
implot/implot_demo.cpp
177+
implot/implot_items.cpp
178+
implot/implot.cpp)
175179

176180
add_subdirectory(SDL EXCLUDE_FROM_ALL)
177181

178182
target_include_directories(iris PRIVATE
179183
imgui
180184
imgui/backends
185+
implot
181186
SDL/include
182187
frontend
183188
incbin

compat.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
"Klonoa 2 - Lunatea's Veil (USA)" - Doesn't work on Release builds (!), requires 16-bit DMAC writes
1212
"Namco Museum 50th Anniversary (USA)" - Requires MFIFO
1313
"R-Type Final (Japan)" - Requires MFIFO
14+
"Sega Ages 2500 Series Vol. 23 - Sega Memorial Selection (Japan)" - GIF DMA read from NULL
1415
"Sega Genesis Collection (USA)" - Works, "forgets" to change the videomode causing wrong graphics at startup (needs 24-bit 640x448 interlaced?)
1516
"Simpsons, The - Hit & Run (USA)" - Needs MFIFO
1617
"Tekken 4 (USA)" - Needs MFIFO
1718
"Tekken Tag Tournament (USA) (v1.00)" - Needs MFIFO
1819
"Thunder Force VI (Japan)" - Crashes on an invalid GIF DMA address when starting up (compare against Dobie)
1920
"Virtua Fighter 4 - Evolution (USA)" - Works, uses filling mode
21+
"Virtua Fighter - Cyber Generation - Judgment Six no Yabou (Japan)" - PMTHL unimplemented
2022
"We Love Katamari (USA)" - Uses filling mode, gets stuck trying to play an FMV after the Namco logo?

frontend/input.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ void handle_keydown_event(iris::instance* iris, SDL_KeyboardEvent& key) {
151151
case SDLK_0: {
152152
ps2_iop_intc_irq(iris->ps2->iop_intc, IOP_INTC_USB);
153153
} break;
154+
case SDLK_I: ds_analog_change(iris->ds[0], DS_AX_LEFT_V, 0xff); break;
155+
case SDLK_J: ds_analog_change(iris->ds[0], DS_AX_LEFT_H, 0); break;
156+
case SDLK_K: ds_analog_change(iris->ds[0], DS_AX_LEFT_V, 0); break;
157+
case SDLK_L: ds_analog_change(iris->ds[0], DS_AX_LEFT_H, 0xff); break;
154158
}
155159

156160
uint16_t mask = map_button(key.key);
@@ -159,6 +163,13 @@ void handle_keydown_event(iris::instance* iris, SDL_KeyboardEvent& key) {
159163
}
160164

161165
void handle_keyup_event(iris::instance* iris, SDL_KeyboardEvent& key) {
166+
switch (key.key) {
167+
case SDLK_I: ds_analog_change(iris->ds[0], DS_AX_LEFT_V, 0x80); break;
168+
case SDLK_J: ds_analog_change(iris->ds[0], DS_AX_LEFT_H, 0x80); break;
169+
case SDLK_K: ds_analog_change(iris->ds[0], DS_AX_LEFT_V, 0x80); break;
170+
case SDLK_L: ds_analog_change(iris->ds[0], DS_AX_LEFT_H, 0x80); break;
171+
}
172+
162173
uint16_t mask = map_button(key.key);
163174

164175
ds_button_release(iris->ds[0], mask);

frontend/iris.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ void update_window(iris::instance* iris) {
247247
// if (iris->show_gamelist) show_gamelist(iris);
248248
if (iris->show_imgui_demo) ShowDemoWindow(&iris->show_imgui_demo);
249249
if (iris->show_bios_setting_window) show_bios_setting_window(iris);
250+
if (iris->show_overlay) show_overlay(iris);
250251

251252
// Display little pause icon in the top right corner
252253
if (iris->pause) {

frontend/iris.hpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,40 @@ struct elf_symbol {
6565
uint32_t size;
6666
};
6767

68+
// Event -> Action
69+
enum {
70+
INPUT_ACTION_PRESS_BUTTON,
71+
INPUT_ACTION_RELEASE_BUTTON,
72+
INPUT_ACTION_MOVE_AXIS
73+
};
74+
75+
enum {
76+
INPUT_CONTROLLER_DUALSHOCK2
77+
78+
// Large To-do list here, we're missing the Namco GunCon
79+
// controllers, JogCon, NegCon, Buzz! Buzzer, the Train
80+
// controllers, Taiko Drum Master controller, the Dance Dance
81+
// Revolution mat, Guitar Hero controllers, etc.
82+
};
83+
84+
// struct input_action {
85+
// int action;
86+
87+
// union {
88+
// uint32_t button;
89+
// uint8_t axis;
90+
// };
91+
// };
92+
93+
// class input_device {
94+
// int controller;
95+
96+
// public:
97+
// void set_controller(int controller);
98+
// int get_controller();
99+
// virtual input_action map_event(SDL_Event* event) = 0;
100+
// };
101+
68102
struct instance {
69103
SDL_Window* window = nullptr;
70104
SDL_GPUDevice* device = nullptr;
@@ -101,6 +135,7 @@ struct instance {
101135
ImFont* font_body = nullptr;
102136
ImFont* font_icons = nullptr;
103137
ImFont* font_icons_big = nullptr;
138+
ImFont* font_black = nullptr;
104139

105140
std::string elf_path = "";
106141
std::string boot_path = "";
@@ -149,6 +184,7 @@ struct instance {
149184
bool show_memory_card_tool = false;
150185
bool show_imgui_demo = false;
151186
bool show_vu_disassembler = false;
187+
bool show_overlay = false;
152188

153189
// Special windows
154190
bool show_bios_setting_window = false;
@@ -177,6 +213,7 @@ struct instance {
177213
int menubar_height = 0;
178214
bool mute = false;
179215
float volume = 1.0f;
216+
int timescale = 8;
180217

181218
bool limit_fps = true;
182219
float fps_cap = 60.0f;
@@ -192,6 +229,8 @@ struct instance {
192229
struct ds_state* ds[2] = { nullptr };
193230
struct mcd_state* mcd[2] = { nullptr };
194231

232+
// input_device* device[2];
233+
195234
float drop_file_alpha = 0.0f;
196235
float drop_file_alpha_delta = 0.0f;
197236
float drop_file_alpha_target = 0.0f;
@@ -239,6 +278,7 @@ void show_settings(iris::instance* iris);
239278
void show_pad_debugger(iris::instance* iris);
240279
void show_symbols(iris::instance* iris);
241280
void show_threads(iris::instance* iris);
281+
void show_overlay(iris::instance* iris);
242282
void show_memory_card_tool(iris::instance* iris);
243283
void show_bios_setting_window(iris::instance* iris);
244284
// void show_gamelist(iris::instance* iris);

frontend/settings.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ int parse_toml_settings(iris::instance* iris) {
8484
iris->integer_scaling = display["integer_scaling"].value_or(false);
8585
iris->scale = display["scale"].value_or(1.5f);
8686
iris->renderer_backend = display["renderer"].value_or(RENDERER_SOFTWARE_THREAD);
87+
iris->window_width = display["window_width"].value_or(960);
88+
iris->window_height = display["window_height"].value_or(720);
8789

8890
auto audio = tbl["audio"];
8991
iris->mute = audio["mute"].value_or(false);
@@ -108,10 +110,13 @@ int parse_toml_settings(iris::instance* iris) {
108110
iris->show_status_bar = debugger["show_status_bar"].value_or(true);
109111
iris->show_pad_debugger = debugger["show_pad_debugger"].value_or(false);
110112
iris->show_threads = debugger["show_threads"].value_or(false);
113+
iris->show_overlay = debugger["show_overlay"].value_or(false);
114+
111115
// iris->show_symbols = debugger["show_symbols"].value_or(false);
112116
iris->show_breakpoints = debugger["show_breakpoints"].value_or(false);
113117
iris->show_imgui_demo = debugger["show_imgui_demo"].value_or(false);
114118
iris->skip_fmv = debugger["skip_fmv"].value_or(false);
119+
iris->timescale = debugger["timescale"].value_or(8);
115120

116121
toml::array* recents = tbl["recents"]["array"].as_array();
117122

@@ -123,6 +128,8 @@ int parse_toml_settings(iris::instance* iris) {
123128
renderer_set_integer_scaling(iris->ctx, iris->integer_scaling);
124129
renderer_set_scale(iris->ctx, iris->scale);
125130

131+
ps2_set_timescale(iris->ps2, iris->timescale);
132+
126133
ee_set_fmv_skip(iris->ps2->ee, iris->skip_fmv);
127134

128135
return 0;
@@ -282,15 +289,19 @@ void close_settings(iris::instance* iris) {
282289
{ "show_breakpoints", iris->show_breakpoints },
283290
{ "show_threads", iris->show_threads },
284291
{ "show_imgui_demo", iris->show_imgui_demo },
285-
{ "skip_fmv", iris->skip_fmv }
292+
{ "show_overlay", iris->show_overlay },
293+
{ "skip_fmv", iris->skip_fmv },
294+
{ "timescale", iris->timescale }
286295
} },
287296
{ "display", toml::table {
288297
{ "scale", iris->scale },
289298
{ "aspect_mode", iris->aspect_mode },
290299
{ "integer_scaling", iris->integer_scaling },
291300
{ "fullscreen", iris->fullscreen },
292301
{ "bilinear", iris->bilinear },
293-
{ "renderer", iris->renderer_backend }
302+
{ "renderer", iris->renderer_backend },
303+
{ "window_width", iris->window_width },
304+
{ "window_height", iris->window_height }
294305
} },
295306
{ "audio", toml::table {
296307
{ "mute", iris->mute },

frontend/ui/menubar.cpp

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ void show_main_menubar(iris::instance* iris) {
234234
ImGui::EndMenu();
235235
}
236236

237-
if (BeginMenu("Scale")) {
237+
if (BeginMenu(ICON_MS_CROP " Scale")) {
238238
for (int i = 2; i <= 6; i++) {
239239
char buf[16]; snprintf(buf, 16, "%.1fx", (float)i * 0.5f);
240240

@@ -248,7 +248,7 @@ void show_main_menubar(iris::instance* iris) {
248248
ImGui::EndMenu();
249249
}
250250

251-
if (BeginMenu("Aspect mode")) {
251+
if (BeginMenu(ICON_MS_ASPECT_RATIO " Aspect mode")) {
252252
for (int i = 0; i < 7; i++) {
253253
if (Selectable(aspect_mode_names[i], iris->aspect_mode == i)) {
254254
iris->aspect_mode = i;
@@ -260,7 +260,7 @@ void show_main_menubar(iris::instance* iris) {
260260
ImGui::EndMenu();
261261
}
262262

263-
if (BeginMenu("Scaling filter")) {
263+
if (BeginMenu(ICON_MS_FILTER " Scaling filter")) {
264264
if (Selectable("Nearest", !iris->bilinear)) {
265265
iris->bilinear = false;
266266

@@ -276,11 +276,43 @@ void show_main_menubar(iris::instance* iris) {
276276
ImGui::EndMenu();
277277
}
278278

279-
if (MenuItem("Integer scaling", nullptr, &iris->integer_scaling)) {
279+
if (BeginMenu(ICON_MS_ASPECT_RATIO " Window size")) {
280+
const char* sizes[] = {
281+
"640x480",
282+
"800x600",
283+
"960x720",
284+
"1024x768",
285+
"1280x720",
286+
"1280x800"
287+
};
288+
289+
int widths[] = {
290+
640, 800, 960, 1024, 1280, 1280
291+
};
292+
293+
int heights[] = {
294+
480, 600, 720, 768, 720, 800
295+
};
296+
297+
for (int i = 0; i < 6; i++) {
298+
bool selected = iris->window_width == widths[i] && iris->window_height == heights[i];
299+
300+
if (MenuItem(sizes[i], nullptr, selected)) {
301+
iris->window_width = widths[i];
302+
iris->window_height = heights[i];
303+
304+
SDL_SetWindowSize(iris->window, iris->window_width, iris->window_height);
305+
}
306+
}
307+
308+
ImGui::EndMenu();
309+
}
310+
311+
if (MenuItem(ICON_MS_SPEED_2X " Integer scaling", nullptr, &iris->integer_scaling)) {
280312
renderer_set_integer_scaling(iris->ctx, iris->integer_scaling);
281313
}
282314

283-
if (MenuItem("Fullscreen", "F11", &iris->fullscreen)) {
315+
if (MenuItem(ICON_MS_FULLSCREEN " Fullscreen", "F11", &iris->fullscreen)) {
284316
SDL_SetWindowFullscreen(iris->window, iris->fullscreen);
285317
}
286318

@@ -385,9 +417,24 @@ void show_main_menubar(iris::instance* iris) {
385417
if (MenuItem(ICON_MS_MEMORY " Memory viewer", NULL, &iris->show_memory_viewer));
386418
if (MenuItem(ICON_MS_VIEW_IN_AR " VU disassembler", NULL, &iris->show_vu_disassembler));
387419
if (MenuItem(ICON_MS_GAMEPAD " DualShock debugger", NULL, &iris->show_pad_debugger));
420+
if (MenuItem(ICON_MS_BUG_REPORT " Performance overlay", NULL, &iris->show_overlay));
388421

389422
Separator();
390423

424+
if (BeginMenu(ICON_MS_MORE_TIME " Timescale")) {
425+
for (int i = 0; i < 9; i++) {
426+
char buf[16]; snprintf(buf, 16, "%dx", 1 << i);
427+
428+
if (Selectable(buf, iris->timescale == (1 << i))) {
429+
iris->timescale = (1 << i);
430+
431+
ps2_set_timescale(iris->ps2, iris->timescale);
432+
}
433+
}
434+
435+
ImGui::EndMenu();
436+
}
437+
391438
if (MenuItem(ICON_MS_SKIP_NEXT " Skip FMVs", NULL, &iris->skip_fmv)) {
392439
printf("Skip FMVs: %d\n", iris->skip_fmv);
393440
ee_set_fmv_skip(iris->ps2->ee, iris->skip_fmv);
@@ -413,6 +460,7 @@ void show_main_menubar(iris::instance* iris) {
413460
iris->show_symbols = false;
414461
iris->show_threads = false;
415462
iris->show_breakpoints = false;
463+
iris->show_overlay = false;
416464
}
417465

418466
ImGui::EndMenu();

frontend/ui/modules.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static inline void show_modules_table(iris::instance* iris) {
6161
// bss section
6262
TableSetColumnIndex(3);
6363
addr += mod->data_size;
64-
Text("0x%08x", iop->module_list[i].text_addr);
64+
Text("0x%08x", addr);
6565

6666
PopFont();
6767
}

0 commit comments

Comments
 (0)