clang format

This commit is contained in:
olebeck 2025-07-06 16:41:04 +02:00
parent 02371e33ba
commit 02b942b491
11 changed files with 418 additions and 434 deletions

View File

@ -61,6 +61,7 @@
#ifdef __vita__
#include "vita/config.h"
#include "vita/messagebox.h"
#include <psp2/appmgr.h>
#include <psp2/kernel/clib.h>
#endif

View File

@ -13,5 +13,5 @@ void VITA_SetupDefaultConfigOverrides(dictionary* p_dictionary)
iniparser_set(p_dictionary, "isle:Draw Cursor", "true");
// Use e_noAnimation/cut transition
//iniparser_set(p_dictionary, "isle:Transition Type", "1");
// iniparser_set(p_dictionary, "isle:Transition Type", "1");
}

View File

@ -1,56 +1,52 @@
#include "messagebox.h"
#include "../../miniwin/src/d3drm/backends/gxm/gxm_context.h"
#include <psp2/common_dialog.h>
#include <psp2/message_dialog.h>
#include "../../miniwin/src/d3drm/backends/gxm/gxm_context.h"
bool Vita_ShowSimpleMessageBox(
SDL_MessageBoxFlags flags,
const char* title,
const char* message,
SDL_Window* window
)
bool Vita_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, const char* title, const char* message, SDL_Window* window)
{
int ret;
SceMsgDialogParam param;
SceMsgDialogUserMessageParam msgParam;
SceMsgDialogButtonsParam buttonParam;
SceMsgDialogResult dialog_result;
SceCommonDialogErrorCode init_result;
bool setup_minimal_gxm = false;
int ret;
SceMsgDialogParam param;
SceMsgDialogUserMessageParam msgParam;
SceMsgDialogButtonsParam buttonParam;
SceMsgDialogResult dialog_result;
SceCommonDialogErrorCode init_result;
bool setup_minimal_gxm = false;
SDL_zero(param);
sceMsgDialogParamInit(&param);
param.mode = SCE_MSG_DIALOG_MODE_USER_MSG;
SDL_zero(param);
sceMsgDialogParamInit(&param);
param.mode = SCE_MSG_DIALOG_MODE_USER_MSG;
SDL_zero(msgParam);
char message_data[0x1000];
SDL_snprintf(message_data, sizeof(message_data), "%s\r\n\r\n%s", title, message);
SDL_zero(msgParam);
char message_data[0x1000];
SDL_snprintf(message_data, sizeof(message_data), "%s\r\n\r\n%s", title, message);
msgParam.msg = (const SceChar8 *)message_data;
msgParam.buttonType = SCE_MSG_DIALOG_BUTTON_TYPE_OK;
param.userMsgParam = &msgParam;
msgParam.msg = (const SceChar8*) message_data;
msgParam.buttonType = SCE_MSG_DIALOG_BUTTON_TYPE_OK;
param.userMsgParam = &msgParam;
if(!gxm) {
gxm = (GXMContext*)SDL_malloc(sizeof(GXMContext));
if (!gxm) {
gxm = (GXMContext*) SDL_malloc(sizeof(GXMContext));
}
if(ret = gxm->init(); ret < 0) {
if (ret = gxm->init(); ret < 0) {
return false;
}
init_result = (SceCommonDialogErrorCode)sceMsgDialogInit(&param);
if (init_result >= 0) {
while (sceMsgDialogGetStatus() == SCE_COMMON_DIALOG_STATUS_RUNNING) {
gxm->clear(0,0,1, true);
gxm->swap_display();
}
SDL_zero(dialog_result);
sceMsgDialogGetResult(&dialog_result);
sceMsgDialogTerm();
return dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_OK;
} else {
return false;
}
return true;
}
init_result = (SceCommonDialogErrorCode) sceMsgDialogInit(&param);
if (init_result >= 0) {
while (sceMsgDialogGetStatus() == SCE_COMMON_DIALOG_STATUS_RUNNING) {
gxm->clear(0, 0, 1, true);
gxm->swap_display();
}
SDL_zero(dialog_result);
sceMsgDialogGetResult(&dialog_result);
sceMsgDialogTerm();
return dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_OK;
}
else {
return false;
}
return true;
}

View File

@ -3,11 +3,6 @@
#include <SDL3/SDL_messagebox.h>
bool Vita_ShowSimpleMessageBox(
SDL_MessageBoxFlags flags,
const char* title,
const char* message,
SDL_Window* window
);
bool Vita_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, const char* title, const char* message, SDL_Window* window);
#endif // VITA_MESSAGE_BOX_H

View File

@ -1,13 +1,14 @@
#pragma once
#include <psp2/gxm.h>
#include "tlsf.h"
#include <psp2/gxm.h>
#define GXM_DISPLAY_BUFFER_COUNT 3
typedef struct Vertex2D {
float position[2];
float texCoord[2];
float texCoord[2];
} Vertex2D;
typedef struct GXMContext {
@ -33,10 +34,9 @@ typedef struct GXMContext {
SceUID patcherVertexUsseUid;
size_t patcherVertexUsseOffset;
void* patcherVertexUsse;
SceUID patcherFragmentUsseUid;
size_t patcherFragmentUsseOffset;
void* patcherFragmentUsse;
void* patcherFragmentUsse;
SceGxmShaderPatcher* shaderPatcher;

View File

@ -281,10 +281,8 @@
#define INCBIN_EXTERN_2(TYPE, NAME) \
INCBIN_EXTERNAL const INCBIN_ALIGN TYPE \
INCBIN_CONCATENATE(INCBIN_CONCATENATE(INCBIN_PREFIX, NAME), INCBIN_STYLE_IDENT(DATA))[]; \
INCBIN_EXTERNAL const INCBIN_ALIGN TYPE* const INCBIN_CONCATENATE( \
INCBIN_CONCATENATE(INCBIN_PREFIX, NAME), \
INCBIN_STYLE_IDENT(END) \
); \
INCBIN_EXTERNAL const INCBIN_ALIGN \
TYPE* const INCBIN_CONCATENATE(INCBIN_CONCATENATE(INCBIN_PREFIX, NAME), INCBIN_STYLE_IDENT(END)); \
INCBIN_EXTERNAL const unsigned int INCBIN_CONCATENATE( \
INCBIN_CONCATENATE(INCBIN_PREFIX, NAME), \
INCBIN_STYLE_IDENT(SIZE) \

File diff suppressed because it is too large Load Diff

View File

@ -12,15 +12,15 @@
#define SCE_ERR(func, ...) \
({ \
DEBUG_ONLY_PRINTF("%s\n", #func); \
DEBUG_ONLY_PRINTF("%s\n", #func); \
int __sce_err_ret_val = func(__VA_ARGS__); \
if (__sce_err_ret_val < 0) { \
sceClibPrintf(#func " error: 0x%x\n", __sce_err_ret_val); \
} \
__sce_err_ret_val; \
__sce_err_ret_val; \
})
#define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1))
#define ALIGN(x, a) (((x) + ((a) -1)) & ~((a) -1))
#define ALIGNMENT(n, a) (((a) - ((n) % (a))) % (a))

View File

@ -153,8 +153,8 @@ HRESULT Direct3DRMImpl::CreateDeviceFromSurface(
DDSDesc.dwSize = sizeof(DDSURFACEDESC);
surface->GetSurfaceDesc(&DDSDesc);
if(false) {}
if (false) {
}
#ifdef USE_SDL_GPU
else if (SDL_memcmp(&guid, &SDL3_GPU_GUID, sizeof(GUID)) == 0) {
DDRenderer = Direct3DRMSDL3GPURenderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight);

View File

@ -352,7 +352,8 @@ HRESULT DirectDrawImpl::CreateDevice(
DDSDesc.dwSize = sizeof(DDSURFACEDESC);
pBackBuffer->GetSurfaceDesc(&DDSDesc);
if(false) {}
if (false) {
}
#ifdef USE_SDL_GPU
else if (SDL_memcmp(&guid, &SDL3_GPU_GUID, sizeof(GUID)) == 0) {
DDRenderer = Direct3DRMSDL3GPURenderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight);

View File

@ -2,17 +2,15 @@
#include "d3drmrenderer.h"
#include "d3drmtexture_impl.h"
#include "ddraw_impl.h"
#include "ddpalette_impl.h"
#include "ddraw_impl.h"
#include "gxm_context.h"
#include <SDL3/SDL.h>
#include <vector>
#include <psp2/gxm.h>
#include <psp2/types.h>
#include <psp2/kernel/clib.h>
#include "gxm_context.h"
#include <psp2/types.h>
#include <vector>
DEFINE_GUID(GXM_GUID, 0x682656F3, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x58, 0x4D);
@ -20,7 +18,7 @@ DEFINE_GUID(GXM_GUID, 0x682656F3, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00,
#define GXM_FRAGMENT_BUFFER_COUNT 3
#define GXM_TEXTURE_BUFFER_COUNT 2
//#define GXM_PRECOMPUTE
// #define GXM_PRECOMPUTE
struct GXMTextureCacheEntry {
IDirect3DRMTexture* texture;
@ -66,21 +64,16 @@ struct GXMSceneLightUniform {
float ambientLight[3];
};
typedef struct Vertex {
float position[3];
float normal[3];
float texCoord[2];
float normal[3];
float texCoord[2];
} Vertex;
class GXMRenderer : public Direct3DRMRenderer {
public:
static Direct3DRMRenderer* Create(DWORD width, DWORD height);
GXMRenderer(
DWORD width,
DWORD height
);
GXMRenderer(int forEnum) {};
GXMRenderer(DWORD width, DWORD height);
~GXMRenderer() override;
void PushLights(const SceneLight* lightsArray, size_t count) override;
@ -113,26 +106,26 @@ class GXMRenderer : public Direct3DRMRenderer {
GXMMeshCacheEntry GXMUploadMesh(const MeshGroup& meshGroup);
void StartScene();
inline const SceGxmTexture* UseTexture(GXMTextureCacheEntry& texture) {
inline const SceGxmTexture* UseTexture(GXMTextureCacheEntry& texture)
{
texture.notifications[texture.currentIndex] = &this->fragmentNotifications[this->currentFragmentBufferIndex];
const SceGxmTexture* gxmTexture = &texture.gxmTexture[texture.currentIndex];
sceGxmSetFragmentTexture(gxm->context, 0, gxmTexture);
return gxmTexture;
}
inline Vertex2D* QuadVerticesBuffer() {
Vertex2D* verts = &this->quadVertices[this->currentVertexBufferIndex][this->quadsUsed*4];
inline Vertex2D* QuadVerticesBuffer()
{
Vertex2D* verts = &this->quadVertices[this->currentVertexBufferIndex][this->quadsUsed * 4];
this->quadsUsed += 1;
if(this->quadsUsed >= 50) {
if (this->quadsUsed >= 50) {
SDL_Log("QuadVerticesBuffer overflow");
this->quadsUsed = 0; // declare bankruptcy
}
return verts;
}
inline GXMSceneLightUniform* LightsBuffer() {
return this->lights[this->currentFragmentBufferIndex];
}
inline GXMSceneLightUniform* LightsBuffer() { return this->lights[this->currentFragmentBufferIndex]; }
std::vector<GXMTextureCacheEntry> m_textures;
std::vector<GXMMeshCacheEntry> m_meshes;
@ -153,15 +146,10 @@ class GXMRenderer : public Direct3DRMRenderer {
SceGxmFragmentProgram* blendedTextureFragmentProgram;
// main shader vertex uniforms
//const SceGxmProgramParameter* uNormalMatrix;
//const SceGxmProgramParameter* uWorldViewProjection;
//const SceGxmProgramParameter* uWorld;
//const SceGxmProgramParameter* uViewInverse;
const SceGxmProgramParameter* uModelViewMatrix;
const SceGxmProgramParameter* uNormalMatrix;
const SceGxmProgramParameter* uProjectionMatrix;
// main shader fragment uniforms
const SceGxmProgramParameter* uShininess;
const SceGxmProgramParameter* uColor;
@ -205,11 +193,10 @@ inline static void GXMRenderer_EnumDevice(LPD3DENUMDEVICESCALLBACK cb, void* ctx
helDesc.dwDeviceRenderBitDepth = DDBD_32;
int ret = gxm_library_init();
if(ret < 0) {
if (ret < 0) {
SDL_Log("gxm_library_init failed: %08x", ret);
return;
}
EnumDevice(cb, ctx, "GXM HAL", &halDesc, &helDesc, GXM_GUID);
}