Skip to content

Commit

Permalink
Optimize renderer.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolf3s committed Sep 22, 2024
1 parent 2418b15 commit ff7652b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ My goal is to make a definitive doom playstation 2 port replacing the [prboom li

## TODO

- Optimize to ensure smooth gameplay
- Fix SDL_GameController on Real Hardware
- Add L3 and R3 for movements
- Fix doom(guy/slayer) above

## License

Expand Down
18 changes: 10 additions & 8 deletions prboom2/src/SDL/i_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1390,22 +1390,22 @@ void I_UpdateVideoMode(void)
}
else
{
#ifdef __PS2__
int flags = SDL_RENDERER_TARGETTEXTURE | SDL_RENDERER_ACCELERATED;
#else
int flags = SDL_RENDERER_TARGETTEXTURE;
#ifdef __PS2__ /* PS2 Currently supports software only */
flags |= SDL_RENDERER_SOFTWARE;
#endif
if (render_vsync && !novsync)
flags |= SDL_RENDERER_PRESENTVSYNC;

#ifdef __PS2__
SDL_SetHint(SDL_HINT_PS2_DYNAMIC_VSYNC, "1");
#endif
sdl_window = SDL_CreateWindow(
PACKAGE_NAME " " PACKAGE_VERSION,
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
SCREENWIDTH, SCREENHEIGHT,
init_flags);
sdl_renderer = SDL_CreateRenderer(sdl_window, -1, flags);
#ifdef __PS2__
SDL_SetHint(SDL_HINT_PS2_DYNAMIC_VSYNC, "1");
#endif

// [FG] aspect ratio correction for the canonical video modes
if (SCREENHEIGHT == 200 || SCREENHEIGHT == 400)
Expand Down Expand Up @@ -1438,9 +1438,11 @@ void I_UpdateVideoMode(void)
screen = SDL_CreateRGBSurface(0, SCREENWIDTH, SCREENHEIGHT, V_GetNumPixelBits(), 0, 0, 0, 0);
buffer = SDL_CreateRGBSurface(0, SCREENWIDTH, SCREENHEIGHT, 32, 0, 0, 0, 0);
SDL_FillRect(buffer, NULL, 0);

#ifdef __PS2__
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, SCREENWIDTH, SCREENHEIGHT);
#else
sdl_texture = SDL_CreateTextureFromSurface(sdl_renderer, buffer);

#endif
if(screen == NULL) {
I_Error("Couldn't set %dx%d video mode [%s]", SCREENWIDTH, SCREENHEIGHT, SDL_GetError());
}
Expand Down
9 changes: 4 additions & 5 deletions prboom2/src/m_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,18 +469,17 @@ default_t defaults[] =
{"Video settings",{NULL},{0},UL,UL,def_none,ss_none},
{"videomode",{NULL, &default_videomode},{0,"8bit"},UL,UL,def_str,ss_none},
/* 640x480 default resolution */
#ifdef __PS2__
{"screen_resolution",{NULL, &screen_resolution},{0,"320x200"},UL,UL,def_str,ss_none},
#else
{"screen_resolution",{NULL, &screen_resolution},{0,"640x480"},UL,UL,def_str,ss_none},
#endif
{"use_fullscreen",{&use_fullscreen},{0},0,1, /* proff 21/05/2000 */
def_bool,ss_none},
{"exclusive_fullscreen",{&exclusive_fullscreen},{0},0,1, // [FG] mode-changing fullscreen
def_bool,ss_none},
#ifdef __PS2__
{"render_vsync",{&render_vsync},{0},0,1,
def_bool,ss_none},
#else
{"render_vsync",{&render_vsync},{1},0,1,
def_bool,ss_none},
#endif
{"translucency",{&default_translucency},{1},0,1, // phares
def_bool,ss_none}, // enables translucency
{"tran_filter_pct",{&tran_filter_pct},{66},0,100, // killough 2/21/98
Expand Down

0 comments on commit ff7652b

Please sign in to comment.