Skip to content

Commit

Permalink
modules/(SceDisplay&GxmInternal): Sutub some function.
Browse files Browse the repository at this point in the history
- Get wave viewer and safe mode working.
  • Loading branch information
Zangetsu38 committed Oct 29, 2024
1 parent 666f3d6 commit 13d9f33
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 13 deletions.
31 changes: 28 additions & 3 deletions vita3k/modules/SceDisplay/SceDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <util/lock_and_find.h>
#include <util/types.h>

#include "io/state.h"

#include <util/tracy.h>
TRACY_MODULE_NAME(SceDisplay);

Expand Down Expand Up @@ -83,9 +85,32 @@ EXPORT(int, _sceDisplayGetFrameBufInternal) {
return UNIMPLEMENTED();
}

EXPORT(int, _sceDisplayGetMaximumFrameBufResolution) {
TRACY_FUNC(_sceDisplayGetMaximumFrameBufResolution);
return UNIMPLEMENTED();
EXPORT(int, _sceDisplayGetMaximumFrameBufResolution, int *width, int *height) {
TRACY_FUNC(_sceDisplayGetMaximumFrameBufResolution, width, height);
if (!width || !height)
return 0;
if (emuenv.cfg.pstv_mode) {
*width = 1920;
*height = 1088;
} else {
auto &title_id = emuenv.io.title_id;
bool cond = title_id == "PCSG80001"
|| title_id == "PCSG80007"
|| title_id == "PCSG00318"
|| title_id == "PCSG00319"
|| title_id == "PCSG00320"
|| title_id == "PCSG00321"
|| title_id == "PCSH00059";
if (cond) {
*width = 960;
*height = 544;

} else {
*width = 1280;
*height = 725;
}
}
return 0;
}

EXPORT(int, _sceDisplayGetResolutionInfoInternal) {
Expand Down
1 change: 1 addition & 0 deletions vita3k/modules/SceDisplay/SceDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ struct SceDisplayFrameBuf2 : public SceDisplayFrameBuf {

DECL_EXPORT(SceInt32, _sceDisplayGetFrameBuf, SceDisplayFrameBuf *pFrameBuf, SceDisplaySetBufSync sync, uint32_t *pFrameBuf_size);
DECL_EXPORT(SceInt32, _sceDisplaySetFrameBuf, const SceDisplayFrameBuf *pFrameBuf, SceDisplaySetBufSync sync, uint32_t *pFrameBuf_size);
DECL_EXPORT(int, _sceDisplayGetMaximumFrameBufResolution, int *width, int *height);
18 changes: 12 additions & 6 deletions vita3k/modules/SceDriverUser/SceDisplayUser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ EXPORT(int, sceDisplayGetFrameBufInternal) {
return UNIMPLEMENTED();
}

EXPORT(int, sceDisplayGetMaximumFrameBufResolution) {
TRACY_FUNC(sceDisplayGetMaximumFrameBufResolution);
return UNIMPLEMENTED();
EXPORT(int, sceDisplayGetMaximumFrameBufResolution, int *width, int *height) {
TRACY_FUNC(sceDisplayGetMaximumFrameBufResolution, width, height);
return CALL_EXPORT(_sceDisplayGetMaximumFrameBufResolution, width, height);
}

EXPORT(int, sceDisplayGetResolutionInfoInternal) {
Expand All @@ -61,7 +61,13 @@ EXPORT(int, sceDisplaySetFrameBufForCompat) {
return UNIMPLEMENTED();
}

EXPORT(int, sceDisplaySetFrameBufInternal) {
TRACY_FUNC(sceDisplaySetFrameBufInternal);
return UNIMPLEMENTED();
EXPORT(int, sceDisplaySetFrameBufInternal, uint32_t maybe_buffer_idx, uint32_t unkn, SceDisplayFrameBuf *pFrameBuf, SceDisplaySetBufSync sync) {
TRACY_FUNC(sceDisplaySetFrameBufInternal, maybe_buffer_idx, unkn, pFrameBuf, sync);
// only render for frame buffer 0 or we'll get double fps
if (maybe_buffer_idx != 0)
return 0;
// size does not match (is 4 bytes larger)
if (pFrameBuf)
pFrameBuf->size = 0x18;
return CALL_EXPORT(_sceDisplaySetFrameBuf, pFrameBuf, sync, nullptr);
}
5 changes: 5 additions & 0 deletions vita3k/modules/SceGxm/SceGxm.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@
#include <module/module.h>

struct SceGxmInitializeParams;
struct SceGxmRenderTargetParams;
struct SceGxmRenderTarget;

DECL_EXPORT(int, sceGxmInitialize, const SceGxmInitializeParams *params);
DECL_EXPORT(int, sceGxmCreateRenderTarget, const SceGxmRenderTargetParams *params, Ptr<SceGxmRenderTarget> *renderTarget);
DECL_EXPORT(int, sceGxmGetRenderTargetMemSize, const SceGxmRenderTargetParams *params, uint32_t *hostMemSize);
10 changes: 6 additions & 4 deletions vita3k/modules/SceGxm/SceGxmInternal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,22 @@

#include <module/module.h>

#include "SceGxm.h"

EXPORT(int, sceGxmCheckMemoryInternal) {
return UNIMPLEMENTED();
}

EXPORT(int, sceGxmCreateRenderTargetInternal) {
return UNIMPLEMENTED();
EXPORT(int, sceGxmCreateRenderTargetInternal, const SceGxmRenderTargetParams *params, Ptr<SceGxmRenderTarget> *renderTarget) {
return CALL_EXPORT(sceGxmCreateRenderTarget, params, renderTarget);
}

EXPORT(int, sceGxmGetDisplayQueueThreadIdInternal) {
return UNIMPLEMENTED();
}

EXPORT(int, sceGxmGetRenderTargetMemSizeInternal) {
return UNIMPLEMENTED();
EXPORT(int, sceGxmGetRenderTargetMemSizeInternal, const SceGxmRenderTargetParams *params, uint32_t *hostMemSize) {
return CALL_EXPORT(sceGxmGetRenderTargetMemSize, params, hostMemSize);
}

EXPORT(int, sceGxmGetTopContextInternal) {
Expand Down

0 comments on commit 13d9f33

Please sign in to comment.