Skip to content

Commit

Permalink
[D3D9] Fixed initialization of d3d9.screenshot.srfc.s.
Browse files Browse the repository at this point in the history
  • Loading branch information
punesemu committed Feb 10, 2024
1 parent 19b3d00 commit c360583
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/core/emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ BYTE emu_reset(BYTE type) {

settings_pgs_parse();

gfx_reset();
gfx_set_screen(NO_CHANGE, NO_CHANGE, NO_CHANGE, NO_CHANGE, NO_CHANGE, TRUE,
(vs_enab != vs_system.enabled) || (vs_ppu != vs_system.ppu));

Expand Down
4 changes: 3 additions & 1 deletion src/video/d3d9/d3d9.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,15 @@ void d3d9_quit(void) {
d3d9.array = d3d9.adapter = NULL;
}

d3d9_reset();
}
void d3d9_reset(void) {
if (d3d9.screenshot.srfc.s) {
IDirect3DSurface9_Release(d3d9.screenshot.srfc.s);
d3d9.screenshot.srfc.s = NULL;
d3d9.screenshot.zone.w = 0;
d3d9.screenshot.zone.h = 0;
}

if (d3d9.screenshot.zone.s) {
IDirect3DSurface9_Release(d3d9.screenshot.zone.s);
d3d9.screenshot.zone.s = NULL;
Expand Down
1 change: 1 addition & 0 deletions src/video/d3d9/d3d9.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ extern _d3d9 d3d9;
#endif

EXTERNC BYTE d3d9_init(void);
EXTERNC void d3d9_reset(void);
EXTERNC BYTE d3d9_context_create(void);
EXTERNC void d3d9_context_delete(BYTE lock);
EXTERNC void d3d9_draw_scene(void);
Expand Down
3 changes: 3 additions & 0 deletions src/video/d3d9/gfx_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ BYTE gfx_api_init(void) {
void gfx_api_quit(void) {
d3d9_quit();
}
void gfx_api_reset(void) {
d3d9_reset();
}
BYTE gfx_api_context_create(void) {
return (d3d9_context_create());
}
Expand Down
3 changes: 3 additions & 0 deletions src/video/gfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ void gfx_quit(void) {

gfx_api_quit();
}
void gfx_reset(void) {
gfx_api_reset();
}
void gfx_set_screen(BYTE scale, DBWORD filter, DBWORD shader, BYTE fullscreen, BYTE palette, BYTE force_scale, BYTE force_palette) {
BYTE set_mode = 0;
WORD width = 0, height = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/video/gfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ extern _gfx gfx;

EXTERNC BYTE gfx_init(void);
EXTERNC void gfx_quit(void);
EXTERNC void gfx_reset(void);
EXTERNC void gfx_set_screen(BYTE scale, DBWORD filter, DBWORD shader, BYTE fullscreen, BYTE palette, BYTE force_scale, BYTE force_palette);
EXTERNC void gfx_draw_screen(BYTE nidx);
EXTERNC void gfx_control_changed_adapter(void *monitor);
Expand All @@ -177,6 +178,7 @@ EXTERNC void gfx_apply_filter(BYTE nidx);

BYTE gfx_api_init(void);
void gfx_api_quit(void);
void gfx_api_reset(void);
BYTE gfx_api_context_create(void);
uint32_t gfx_api_color(BYTE a, BYTE r, BYTE g, BYTE b);
void gfx_api_overlay_blit(void *surface, _gfx_rect *rect, double device_pixel_ratio);
Expand Down
1 change: 1 addition & 0 deletions src/video/opengl/gfx_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ BYTE gfx_api_init(void) {
void gfx_api_quit(void) {
opengl_quit();
}
void gfx_api_reset(void) {}
BYTE gfx_api_context_create(void) {
return (opengl_context_create());
}
Expand Down

0 comments on commit c360583

Please sign in to comment.