diff --git a/src/liberty/core/MenuScreensCustom.cpp b/src/liberty/core/MenuScreensCustom.cpp index abd7694d..23a9b7e2 100644 --- a/src/liberty/core/MenuScreensCustom.cpp +++ b/src/liberty/core/MenuScreensCustom.cpp @@ -902,11 +902,11 @@ CMenuScreenCustom aScreens[MENUPAGES] = { #ifndef GTA_HANDHELD MENUACTION_SCREENRES, "FED_RES", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, #endif + MULTISAMPLING_SELECTOR MENUACTION_WIDESCREEN, "FED_WIS", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, VIDEOMODE_SELECTOR MENUACTION_FRAMESYNC, "FEM_VSC", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, MENUACTION_FRAMELIMIT, "FEM_FRM", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, - MULTISAMPLING_SELECTOR ISLAND_LOADING_SELECTOR DUALPASS_SELECTOR #ifdef EXTENDED_COLOURFILTER diff --git a/src/liberty/core/common.h b/src/liberty/core/common.h index 3f2e5b2a..661499d6 100644 --- a/src/liberty/core/common.h +++ b/src/liberty/core/common.h @@ -187,8 +187,8 @@ __always_inline uint32 ldb(uint32 p, uint32 s, uint32 w) #define SCREEN_HEIGHT ((float)448) #endif #else -#define SCREEN_WIDTH ((float)640) -#define SCREEN_HEIGHT ((float)480) +#define SCREEN_WIDTH ((float)RsGlobal.width) +#define SCREEN_HEIGHT ((float)RsGlobal.height) #endif #define SCREEN_HEIGHT_PAL ((float)512) diff --git a/src/liberty/core/config.h b/src/liberty/core/config.h index 1da628f8..e8fa4443 100644 --- a/src/liberty/core/config.h +++ b/src/liberty/core/config.h @@ -212,7 +212,7 @@ enum Config { // these are placed here to work with VANILLA_DEFINES for compatibility #define NO_CDCHECK // skip audio CD check -#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch) +// #define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch) #ifdef VANILLA_DEFINES #if !defined(_WIN32) || defined(__LP64__) || defined(_WIN64) @@ -308,10 +308,10 @@ enum Config { // NB: keep this enabled unless your map IDEs have these flags baked in #define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios #define PROPER_SCALING // use original DEFAULT_SCREEN_WIDTH/DEFAULT_SCREEN_HEIGHT from PS2 instead of PC(R* changed HEIGHT here to make radar look better, but broke other hud elements aspect ratio). -#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch) +// #define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch) // #define USE_TXD_CDIMAGE // generate and load textures from txd.img // #define PS2_ALPHA_TEST // emulate ps2 alpha test -#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number +// #define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number // #define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time #ifdef DISABLE_LOADING_SCREEN // enable the PC splash diff --git a/src/miami/core/MenuScreensCustom.cpp b/src/miami/core/MenuScreensCustom.cpp index ca3db581..2af06c89 100644 --- a/src/miami/core/MenuScreensCustom.cpp +++ b/src/miami/core/MenuScreensCustom.cpp @@ -771,13 +771,13 @@ CMenuScreenCustom aScreens[] = { #ifndef GTA_HANDHELD MENUACTION_SCREENRES, "FED_RES", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, 0, 0, MENUALIGN_LEFT, #endif + MULTISAMPLING_SELECTOR MENUACTION_WIDESCREEN, "FED_WIS", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, 0, 0, MENUALIGN_LEFT, VIDEOMODE_SELECTOR #ifdef LEGACY_MENU_OPTIONS MENUACTION_FRAMESYNC, "FEM_VSC", {nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS}, 0, 0, MENUALIGN_LEFT, #endif MENUACTION_FRAMELIMIT, "FEM_FRM", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, 0, 0, MENUALIGN_LEFT, - MULTISAMPLING_SELECTOR ISLAND_LOADING_SELECTOR DUALPASS_SELECTOR #ifdef EXTENDED_COLOURFILTER diff --git a/src/miami/core/config.h b/src/miami/core/config.h index edd9a370..a4b6d889 100644 --- a/src/miami/core/config.h +++ b/src/miami/core/config.h @@ -238,7 +238,7 @@ enum Config { // these are placed here to work with VANILLA_DEFINES for compatibility #define NO_CDCHECK // skip audio CD check -#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch) +// #define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch) #ifdef VANILLA_DEFINES #if !defined(_WIN32) || defined(__LP64__) || defined(_WIN64) @@ -332,10 +332,10 @@ enum Config { // Rendering/display #define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios #define PROPER_SCALING // use original DEFAULT_SCREEN_WIDTH/DEFAULT_SCREEN_HEIGHT from PS2 instead of PC(R* changed HEIGHT here to make radar look better, but broke other hud elements aspect ratio). -#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch) +// #define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch) #define USE_TXD_CDIMAGE // generate and load textures from txd.img #define PS2_ALPHA_TEST // emulate ps2 alpha test -#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number +// #define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number //#define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time #define DISABLE_VSYNC_ON_TEXTURE_CONVERSION // make texture conversion work faster by disabling vsync #define ANISOTROPIC_FILTERING // set all textures to max anisotropic filtering diff --git a/src/miami/renderer/MBlur.cpp b/src/miami/renderer/MBlur.cpp index cc8270ce..04314a83 100644 --- a/src/miami/renderer/MBlur.cpp +++ b/src/miami/renderer/MBlur.cpp @@ -110,7 +110,8 @@ CMBlur::MotionBlurOpen(RwCamera *cam) rect.w = width; rect.h = height; - pFrontBuffer = RwRasterCreate(rect.w, rect.h, depth, rwRASTERTYPECAMERATEXTURE); + // MBlur disabled for now (skmp) + pFrontBuffer = nullptr; // RwRasterCreate(rect.w, rect.h, depth, rwRASTERTYPECAMERATEXTURE); if ( !pFrontBuffer ) { debug("MBlurOpen can't create raster."); diff --git a/vendor/emu/refsw/refsw_lists.cpp b/vendor/emu/refsw/refsw_lists.cpp index afe444e8..90a6e720 100644 --- a/vendor/emu/refsw/refsw_lists.cpp +++ b/vendor/emu/refsw/refsw_lists.cpp @@ -430,7 +430,7 @@ void RenderCORE() { auto base = (interlace && field) ? FB_W_SOF2 : FB_W_SOF1; // very few configurations supported here - verify(SCALER_CTL.hscale == 0); + size_t xpixels = SCALER_CTL.hscale ? 16 : 32; verify(SCALER_CTL.interlace == 0); // write both SOFs auto vscale = SCALER_CTL.vscalefactor; verify(vscale == 0x401 || vscale == 0x400 || vscale == 0x800); @@ -440,14 +440,14 @@ void RenderCORE() { auto src = copy; auto bpp = fb_packmode == 0x1 ? 2 : 4; - auto offset_bytes = entry.control.tilex * 32 * bpp + entry.control.tiley * 32 * FB_W_LINESTRIDE.stride * 8; + auto offset_bytes = entry.control.tilex * xpixels * bpp + entry.control.tiley * 32 * FB_W_LINESTRIDE.stride * 8; for (int y = 0; y < 32; y++) { //auto base = (y&1) ? FB_W_SOF2 : FB_W_SOF1; auto dst = base + offset_bytes + (y)*FB_W_LINESTRIDE.stride * 8; - for (int x = 0; x < 32; x++) + for (int x = 0; x < xpixels; x++) { if (fb_packmode == 0x1) { auto pixel = (((src[0] >> 3) & 0x1F) << 0) | (((src[1] >> 2) & 0x3F) << 5) | (((src[2] >> 3) & 0x1F) << 11); @@ -461,6 +461,11 @@ void RenderCORE() { dst += bpp; src += 4; // skip alpha + + // TODO: Actually do AA + if (SCALER_CTL.hscale) { + src += 4; + } } } } diff --git a/vendor/librw/src/dc/rwdc.cpp b/vendor/librw/src/dc/rwdc.cpp index c18cabe3..48549bc0 100644 --- a/vendor/librw/src/dc/rwdc.cpp +++ b/vendor/librw/src/dc/rwdc.cpp @@ -174,12 +174,11 @@ static pvr_dr_state_t drState; #include +float VIDEO_MODE_SCALE_X; + #if !defined(DC_TEXCONV) && !defined(DC_SIM) #include -#define VIDEO_MODE_WIDTH vid_mode->width -#define VIDEO_MODE_HEIGHT vid_mode->height - #define mat_trans_nodiv_nomod(x, y, z, x2, y2, z2, w2) do { \ register float __x __asm__("fr12") = (x); \ register float __y __asm__("fr13") = (y); \ @@ -289,8 +288,6 @@ void rw_mat_load_4x4(rw::Matrix* mtx) { } #include -#define VIDEO_MODE_WIDTH 640 -#define VIDEO_MODE_HEIGHT 480 #define frsqrt(a) (1.0f/sqrt(a)) #define dcache_pref_block(a) __builtin_prefetch(a) @@ -554,8 +551,6 @@ void DCE_InitMatrices() { mat_identity(); mat_store(&DCE_MAT_SCREENVIEW); - - DCE_MatrixViewport(0, 0, VIDEO_MODE_WIDTH, VIDEO_MODE_HEIGHT); } } @@ -789,7 +784,7 @@ void beginUpdate(Camera* cam) { proj[14] = -cam->nearPlane*proj[10]; memcpy4(&cam->devProj, proj, sizeof(RawMatrix)); - DCE_MatrixViewport(0, 0, cam->frameBuffer->width, cam->frameBuffer->height); + DCE_MatrixViewport(0, 0, cam->frameBuffer->width * VIDEO_MODE_SCALE_X, cam->frameBuffer->height); mat_load((matrix_t*)&DCE_MAT_SCREENVIEW); mat_apply((matrix_t*)&cam->devProj); @@ -831,7 +826,7 @@ void dcMotionBlur_v1(uint8_t a, uint8_t r, uint8_t g, uint8_t b) { auto doquad = [=](float x, float y, float w, float h, float tx, float ty, float tw, float th) { auto vtx = reinterpret_cast(pvr_dr_target(drState)); vtx->flags = PVR_CMD_VERTEX; - vtx->x = x; + vtx->x = x * VIDEO_MODE_SCALE_X; vtx->y = y; vtx->z = 1000000.0f; vtx->u = tx/1024.f; @@ -841,7 +836,7 @@ void dcMotionBlur_v1(uint8_t a, uint8_t r, uint8_t g, uint8_t b) { vtx = reinterpret_cast(pvr_dr_target(drState)); vtx->flags = PVR_CMD_VERTEX; - vtx->x = x+w; + vtx->x = (x+w) * VIDEO_MODE_SCALE_X; vtx->y = y; vtx->z = 1000000.0f; vtx->u = (tx+tw)/1024.f; @@ -851,7 +846,7 @@ void dcMotionBlur_v1(uint8_t a, uint8_t r, uint8_t g, uint8_t b) { vtx = reinterpret_cast(pvr_dr_target(drState)); vtx->flags = PVR_CMD_VERTEX; - vtx->x = x; + vtx->x = x * VIDEO_MODE_SCALE_X; vtx->y = y+h; vtx->z = 1000000.0f; vtx->u = tx/1024.f; @@ -861,7 +856,7 @@ void dcMotionBlur_v1(uint8_t a, uint8_t r, uint8_t g, uint8_t b) { vtx = reinterpret_cast(pvr_dr_target(drState)); vtx->flags = PVR_CMD_VERTEX_EOL; - vtx->x = x+w; + vtx->x = (x+w) * VIDEO_MODE_SCALE_X; vtx->y = y+h; vtx->z = 1000000.0f; vtx->u = (tx+tw)/1024.f; @@ -935,7 +930,7 @@ void dcMotionBlur_v3(uint8_t a, uint8_t r, uint8_t g, uint8_t b) { float umin, float umax, float vmin, float vmax, uint32_t col) { auto vtx = reinterpret_cast(pvr_dr_target(drState)); vtx->flags = PVR_CMD_VERTEX; - vtx->x = x; + vtx->x = x * VIDEO_MODE_SCALE_X; vtx->y = y; vtx->z = z; vtx->u = umin; @@ -945,7 +940,7 @@ void dcMotionBlur_v3(uint8_t a, uint8_t r, uint8_t g, uint8_t b) { vtx = reinterpret_cast(pvr_dr_target(drState)); vtx->flags = PVR_CMD_VERTEX; - vtx->x = x+w; + vtx->x = (x+w) * VIDEO_MODE_SCALE_X; vtx->y = y; vtx->z = z; vtx->u = umax; @@ -955,7 +950,7 @@ void dcMotionBlur_v3(uint8_t a, uint8_t r, uint8_t g, uint8_t b) { vtx = reinterpret_cast(pvr_dr_target(drState)); vtx->flags = PVR_CMD_VERTEX; - vtx->x = x; + vtx->x = x * VIDEO_MODE_SCALE_X; vtx->y = y+h; vtx->z = z; vtx->u = umin; @@ -965,7 +960,7 @@ void dcMotionBlur_v3(uint8_t a, uint8_t r, uint8_t g, uint8_t b) { vtx = reinterpret_cast(pvr_dr_target(drState)); vtx->flags = PVR_CMD_VERTEX_EOL; - vtx->x = x+w; + vtx->x = (x+w) * VIDEO_MODE_SCALE_X; vtx->y = y+h; vtx->z = z; vtx->u = umax; @@ -1508,7 +1503,7 @@ void im2DRenderPrimitive(PrimitiveType primType, void *vertices, int32_t numVert { auto *pvrVert = pvr_dr_target(drState); pvrVert->flags = flags; - pvrVert->x = gtaVert.x; + pvrVert->x = gtaVert.x * VIDEO_MODE_SCALE_X; pvrVert->y = gtaVert.y; pvrVert->z = MATH_Fast_Invert(gtaVert.w); // this is perfect for almost every case... pvrVert->u = gtaVert.u; @@ -4581,6 +4576,14 @@ rasterToImage(Raster*) return nil; } +static pvr_init_params_t pvr_params = { + .opb_sizes = { + PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_8, PVR_BINSIZE_0, + PVR_BINSIZE_8 + }, + .autosort_disabled = true +}; + int deviceSystem(DeviceReq req, void *arg0, int32 n) { @@ -4616,15 +4619,22 @@ deviceSystem(DeviceReq req, void *arg0, int32 n) rwmode->flags = VIDEOMODEEXCLUSIVE; return 1; } - - case DEVICEGETMAXMULTISAMPLINGLEVELS: - { - return 1; - } + return 2; case DEVICEGETMULTISAMPLINGLEVELS: - return 1; + return 1 << pvr_params.fsaa_enabled; case DEVICESETMULTISAMPLINGLEVELS: + if (n == 1) { + VIDEO_MODE_SCALE_X = 1; + pvr_params.fsaa_enabled = 0; + pvr_params.vertex_buf_size = (1024 + 1024) * 1024; + pvr_params.opb_overflow_count = 7; // 268800 bytes + } else { + VIDEO_MODE_SCALE_X = 2; + pvr_params.fsaa_enabled = 1; + pvr_params.vertex_buf_size = (1024 + 768) * 1024; + pvr_params.opb_overflow_count = 4; // 307200 bytes + } return 1; case DEVICESETSUBSYSTEM: return 1; @@ -4661,16 +4671,6 @@ Device renderdevice = { deviceSystem }; -static pvr_init_params_t pvr_params = { - .opb_sizes = { - PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_8, PVR_BINSIZE_0, - PVR_BINSIZE_8 - }, - .vertex_buf_size = (1024 + 1024) * 1024, - .autosort_disabled = true, - .opb_overflow_count = 7 // 268800 bytes -}; - void defaultInstance(ObjPipeline *pipe, Atomic *atomic) { #if defined(DC_TEXCONV) processGeom(atomic->geometry); @@ -4758,6 +4758,8 @@ driverClose(void *o, int32, int32) { pvr_mem_free(fake_tex); + pvr_shutdown(); + return o; }