Fixed PSP rendering

This commit is contained in:
2025-11-09 14:54:33 -06:00
parent 587d716aae
commit aaa8622956
11 changed files with 30 additions and 8 deletions

View File

@@ -115,6 +115,7 @@ if(DUSK_TARGET_SYSTEM STREQUAL "psp")
BACKGROUND_PATH NULL BACKGROUND_PATH NULL
PREVIEW_PATH NULL PREVIEW_PATH NULL
TITLE "${DUSK_TARGET_NAME}" TITLE "${DUSK_TARGET_NAME}"
PSAR_PATH ${DUSK_BUILD_DIR}/dusk.dsk
VERSION 01.00 VERSION 01.00
) )
endif() endif()

View File

@@ -3,4 +3,4 @@
# This software is released under the MIT License. # This software is released under the MIT License.
# https://opensource.org/licenses/MIT # https://opensource.org/licenses/MIT
add_asset(TILESET minogram.png type=ALPHA tileWidth=6 tileHeight=10 columns=16 rows=6) add_asset(TILESET minogram.png type=PALETTIZED tileWidth=6 tileHeight=10 columns=16 rows=6)# Fixes PSP rendering

View File

@@ -31,7 +31,7 @@ if(NOT TARGET pspsdk)
if(NOT PSPSDK_PSP_GCC) if(NOT PSPSDK_PSP_GCC)
message(STATUS "psp-gcc not found in system paths. Downloading PSPSDK tarball...") message(STATUS "psp-gcc not found in system paths. Downloading PSPSDK tarball...")
file(DOWNLOAD file(DOWNLOAD
"https://github.com/pspdev/pspdev/releases/tag/v20251101/download/pspdev-ubuntu-latest-x86_64.tar.gz" "https://github.com/pspdev/pspdev/releases/download/v20251101/pspdev-ubuntu-latest-x86_64.tar.gz"
"${CMAKE_BINARY_DIR}/pspsdk.tar.gz" "${CMAKE_BINARY_DIR}/pspsdk.tar.gz"
EXPECTED_HASH SHA256=8f8abc2a3008ec1e97c6ba706152a45e4f031c8d10db2102c3c68ce24fa6fcaf EXPECTED_HASH SHA256=8f8abc2a3008ec1e97c6ba706152a45e4f031c8d10db2102c3c68ce24fa6fcaf
SHOW_PROGRESS SHOW_PROGRESS

View File

@@ -10,6 +10,13 @@
#include "assettype.h" #include "assettype.h"
#if ASSET_TYPE == wad #if ASSET_TYPE == wad
#if PSP
typedef struct {
uint8_t signature[4];
uint16_t version[2];
unsigned int offset[8];
} assetpbp_t;
#endif
#else #else
#error "Unsupported ASSET_TYPE" #error "Unsupported ASSET_TYPE"
#endif #endif

View File

@@ -52,6 +52,11 @@ void cameraPushMatrix(camera_t *camera) {
switch(camera->projType) { switch(camera->projType) {
case CAMERA_PROJECTION_TYPE_ORTHOGRAPHIC: case CAMERA_PROJECTION_TYPE_ORTHOGRAPHIC:
assertTrue(
camera->orthographic.right != camera->orthographic.left &&
camera->orthographic.top != camera->orthographic.bottom,
"Invalid orthographic projection parameters"
);
glm_ortho( glm_ortho(
camera->orthographic.left, camera->orthographic.left,
camera->orthographic.right, camera->orthographic.right,
@@ -117,7 +122,6 @@ void cameraPushMatrix(camera_t *camera) {
glm_vec3_copy(camera->lookatPixelPerfect.target, position); glm_vec3_copy(camera->lookatPixelPerfect.target, position);
glm_vec3_add(position, camera->lookatPixelPerfect.offset, position); glm_vec3_add(position, camera->lookatPixelPerfect.offset, position);
position[2] += z; position[2] += z;
glm_lookat( glm_lookat(
position, position,
camera->lookatPixelPerfect.target, camera->lookatPixelPerfect.target,

View File

@@ -41,6 +41,9 @@ void screenInit() {
SCREEN.frameBufferMeshVertices SCREEN.frameBufferMeshVertices
); );
#endif #endif
// Init screen to backbuffer mode by default
screenBind();
} }
void screenBind() { void screenBind() {

View File

@@ -170,6 +170,7 @@ void textureBind(const texture_t *texture) {
#if DISPLAY_SDL2 #if DISPLAY_SDL2
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture->id); glBindTexture(GL_TEXTURE_2D, texture->id);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
#endif #endif
TEXTURE_BOUND = texture; TEXTURE_BOUND = texture;
} }

View File

@@ -52,10 +52,10 @@ void inputInit(void) {
inputBind(inputButtonGetByName("right"), INPUT_ACTION_RIGHT); inputBind(inputButtonGetByName("right"), INPUT_ACTION_RIGHT);
inputBind(inputButtonGetByName("circle"), INPUT_ACTION_CANCEL); inputBind(inputButtonGetByName("circle"), INPUT_ACTION_CANCEL);
inputBind(inputButtonGetByName("cross"), INPUT_ACTION_ACCEPT); inputBind(inputButtonGetByName("cross"), INPUT_ACTION_ACCEPT);
inputBind(inputButtonGetByName("lstick_negative_y"), INPUT_ACTION_UP); // inputBind(inputButtonGetByName("lstick_negative_y"), INPUT_ACTION_UP);
inputBind(inputButtonGetByName("lstick_positive_y"), INPUT_ACTION_DOWN); // inputBind(inputButtonGetByName("lstick_positive_y"), INPUT_ACTION_DOWN);
inputBind(inputButtonGetByName("lstick_negative_x"), INPUT_ACTION_LEFT); // inputBind(inputButtonGetByName("lstick_negative_x"), INPUT_ACTION_LEFT);
inputBind(inputButtonGetByName("lstick_positive_x"), INPUT_ACTION_RIGHT); // inputBind(inputButtonGetByName("lstick_positive_x"), INPUT_ACTION_RIGHT);
#endif #endif
#endif #endif
#endif #endif

View File

@@ -11,6 +11,12 @@
#include "input/input.h" #include "input/input.h"
int main(int argc, char **argv) { int main(int argc, char **argv) {
// Write out launch args
printf("Launching Dusk with %d args:\n", argc);
for(int i = 0; i < argc; i++) {
printf(" Arg %d: %s\n", i, argv[i]);
}
errorret_t ret; errorret_t ret;
// Init engine // Init engine

View File

@@ -44,7 +44,6 @@ void uiRender(void) {
uiFPSRender(UI.fontTileset, &UI.fontTexture); uiFPSRender(UI.fontTileset, &UI.fontTexture);
uiTextboxRender(); uiTextboxRender();
} }
cameraPopMatrix(); cameraPopMatrix();
} }

1
test.txt Normal file
View File

@@ -0,0 +1 @@
PSAR_HERE