Remove vita for now
This commit is contained in:
@@ -15,11 +15,6 @@ elseif(DUSK_TARGET_SYSTEM STREQUAL "psp")
|
||||
add_subdirectory(dusksdl2)
|
||||
add_subdirectory(duskgl)
|
||||
|
||||
elseif(DUSK_TARGET_SYSTEM STREQUAL "vita")
|
||||
add_subdirectory(duskvita)
|
||||
add_subdirectory(dusksdl2)
|
||||
add_subdirectory(duskgl)
|
||||
|
||||
elseif(DUSK_TARGET_SYSTEM STREQUAL "wii" OR DUSK_TARGET_SYSTEM STREQUAL "gamecube")
|
||||
add_subdirectory(duskdolphin)
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
# Copyright (c) 2026 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Includes
|
||||
target_include_directories(${DUSK_LIBRARY_TARGET_NAME}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
||||
|
||||
# Sources
|
||||
target_sources(${DUSK_BINARY_TARGET_NAME}
|
||||
PUBLIC
|
||||
)
|
||||
|
||||
# Subdirs
|
||||
add_subdirectory(asset)
|
||||
add_subdirectory(input)
|
||||
add_subdirectory(log)
|
||||
add_subdirectory(save)
|
||||
@@ -1,10 +0,0 @@
|
||||
# Copyright (c) 2026 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Sources
|
||||
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||
PUBLIC
|
||||
assetvita.c
|
||||
)
|
||||
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "assetvita.h"
|
||||
|
||||
typedef assetvita_t assetplatform_t;
|
||||
#define assetInitPlatform assetInitVita
|
||||
#define assetDisposePlatform assetDisposeVita
|
||||
@@ -1,22 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "asset/asset.h"
|
||||
#include "assert/assert.h"
|
||||
|
||||
errorret_t assetInitVita(void) {
|
||||
int32_t error;
|
||||
ASSET.zip = zip_open(ASSET_VITA_DSK_PATH, ZIP_RDONLY, &error);
|
||||
if(ASSET.zip == NULL) {
|
||||
errorThrow("Failed to open asset file: " ASSET_VITA_DSK_PATH);
|
||||
}
|
||||
errorOk();
|
||||
}
|
||||
|
||||
errorret_t assetDisposeVita(void) {
|
||||
errorOk();
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "error/error.h"
|
||||
|
||||
// dusk.dsk is packaged at the root of the VPK and accessible via app0:/
|
||||
#define ASSET_VITA_DSK_PATH "app0:/" ASSET_FILE_NAME
|
||||
|
||||
typedef struct {
|
||||
uint8_t _unused;
|
||||
} assetvita_t;
|
||||
|
||||
/**
|
||||
* Initializes the Vita asset system, opening dusk.dsk from the VPK mount.
|
||||
*
|
||||
* @returns An errorret_t indicating success or failure.
|
||||
*/
|
||||
errorret_t assetInitVita(void);
|
||||
|
||||
/**
|
||||
* Disposes the Vita asset system.
|
||||
*
|
||||
* @returns An errorret_t indicating success or failure.
|
||||
*/
|
||||
errorret_t assetDisposeVita(void);
|
||||
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "display/displaysdl2.h"
|
||||
|
||||
typedef displaysdl2_t displayplatform_t;
|
||||
|
||||
#define displayPlatformInit displaySDL2Init
|
||||
#define displayPlatformUpdate displaySDL2Update
|
||||
#define displayPlatformSwap displaySDL2Swap
|
||||
#define displayPlatformDispose displaySDL2Dispose
|
||||
@@ -1,23 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <vitasdk.h>
|
||||
|
||||
#define GL_COLOR_INDEX8_EXT 0x80E5
|
||||
#define GL_NO_ERROR 0
|
||||
#define glDrawArrays(type, first, count) ((void)0)
|
||||
#define glColorTableEXT( \
|
||||
target, internalformat, count, format, type, pixels) ((void)0)
|
||||
#define glDepthFunc(func) ((void)0)
|
||||
#define glBlendFunc(sfactor, dfactor) ((void)0)
|
||||
#define glGetError() GL_NO_ERROR
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
|
||||
typedef uint32_t GLbitfield;
|
||||
|
||||
#include "dusksdl2.h"
|
||||
@@ -1,10 +0,0 @@
|
||||
# Copyright (c) 2026 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Sources
|
||||
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||
PUBLIC
|
||||
inputvita.c
|
||||
)
|
||||
@@ -1,87 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "input/input.h"
|
||||
|
||||
inputbuttondata_t INPUT_BUTTON_DATA[] = {
|
||||
{ .name = "triangle", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
||||
.gpButton = SDL_CONTROLLER_BUTTON_Y } },
|
||||
{ .name = "cross", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
||||
.gpButton = SDL_CONTROLLER_BUTTON_A } },
|
||||
{ .name = "circle", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
||||
.gpButton = SDL_CONTROLLER_BUTTON_B } },
|
||||
{ .name = "square", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
||||
.gpButton = SDL_CONTROLLER_BUTTON_X } },
|
||||
{ .name = "start", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
||||
.gpButton = SDL_CONTROLLER_BUTTON_START } },
|
||||
{ .name = "select", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
||||
.gpButton = SDL_CONTROLLER_BUTTON_BACK } },
|
||||
{ .name = "up", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
||||
.gpButton = SDL_CONTROLLER_BUTTON_DPAD_UP } },
|
||||
{ .name = "down", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
||||
.gpButton = SDL_CONTROLLER_BUTTON_DPAD_DOWN } },
|
||||
{ .name = "left", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
||||
.gpButton = SDL_CONTROLLER_BUTTON_DPAD_LEFT } },
|
||||
{ .name = "right", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
||||
.gpButton = SDL_CONTROLLER_BUTTON_DPAD_RIGHT } },
|
||||
{ .name = "l", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
||||
.gpButton = SDL_CONTROLLER_BUTTON_LEFTSHOULDER } },
|
||||
{ .name = "r", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
||||
.gpButton = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER } },
|
||||
|
||||
{ .name = "lstick_down", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS,
|
||||
.gpAxis = {
|
||||
.axis = SDL_CONTROLLER_AXIS_LEFTY, .positive = true } } },
|
||||
{ .name = "lstick_up", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS,
|
||||
.gpAxis = {
|
||||
.axis = SDL_CONTROLLER_AXIS_LEFTY, .positive = false } } },
|
||||
{ .name = "lstick_right", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS,
|
||||
.gpAxis = {
|
||||
.axis = SDL_CONTROLLER_AXIS_LEFTX, .positive = true } } },
|
||||
{ .name = "lstick_left", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS,
|
||||
.gpAxis = {
|
||||
.axis = SDL_CONTROLLER_AXIS_LEFTX, .positive = false } } },
|
||||
|
||||
{ .name = "rstick_down", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS,
|
||||
.gpAxis = {
|
||||
.axis = SDL_CONTROLLER_AXIS_RIGHTY, .positive = true } } },
|
||||
{ .name = "rstick_up", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS,
|
||||
.gpAxis = {
|
||||
.axis = SDL_CONTROLLER_AXIS_RIGHTY, .positive = false } } },
|
||||
{ .name = "rstick_right", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS,
|
||||
.gpAxis = {
|
||||
.axis = SDL_CONTROLLER_AXIS_RIGHTX, .positive = true } } },
|
||||
{ .name = "rstick_left", {
|
||||
.type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS,
|
||||
.gpAxis = {
|
||||
.axis = SDL_CONTROLLER_AXIS_RIGHTX, .positive = false } } },
|
||||
|
||||
{ .name = NULL }
|
||||
};
|
||||
|
||||
float_t inputGetDeadzoneSDL2(const inputbutton_t button) {
|
||||
return 0.17f;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
# Copyright (c) 2026 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Sources
|
||||
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||
PUBLIC
|
||||
log.c
|
||||
)
|
||||
@@ -1,52 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "log/log.h"
|
||||
|
||||
void logDebug(const char_t *message, ...) {
|
||||
va_list args;
|
||||
va_start(args, message);
|
||||
|
||||
// print to stdout
|
||||
va_list copy;
|
||||
va_copy(copy, args);
|
||||
vprintf(message, copy);
|
||||
va_end(copy);
|
||||
|
||||
// print to file
|
||||
FILE *file = fopen("ux0:data/Dusk/debug.log", "a");
|
||||
if(file) {
|
||||
va_copy(copy, args);
|
||||
vfprintf(file, message, copy);
|
||||
va_end(copy);
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void logError(const char_t *message, ...) {
|
||||
va_list args;
|
||||
va_start(args, message);
|
||||
|
||||
// print to stderr
|
||||
va_list copy;
|
||||
va_copy(copy, args);
|
||||
vfprintf(stderr, message, copy);
|
||||
va_end(copy);
|
||||
|
||||
// print to file
|
||||
FILE *file = fopen("ux0:data/Dusk/error.log", "a");
|
||||
if(file) {
|
||||
va_copy(copy, args);
|
||||
vfprintf(file, message, copy);
|
||||
va_end(copy);
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
# Copyright (c) 2026 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Sources
|
||||
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||
PUBLIC
|
||||
savevita.c
|
||||
savestreamvita.c
|
||||
)
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "save/savevita.h"
|
||||
#include "save/savestreamvita.h"
|
||||
|
||||
typedef savevita_t saveplatform_t;
|
||||
typedef savestreamvita_t saveplatformstream_t;
|
||||
|
||||
#define saveInitPlatform saveInitVita
|
||||
#define saveDisposePlatform saveDisposeVita
|
||||
#define saveDeletePlatform saveDeleteVita
|
||||
|
||||
#define saveStreamOpenReadPlatform(stream, slot) \
|
||||
saveStreamOpenReadVita(&(stream)->platform, &(stream)->found, slot)
|
||||
#define saveStreamOpenWritePlatform(stream, slot) \
|
||||
saveStreamOpenWriteVita(&(stream)->platform, slot)
|
||||
#define saveStreamClosePlatform(stream) \
|
||||
saveStreamCloseVita(&(stream)->platform)
|
||||
#define saveStreamReadBytesPlatform(stream, buf, len) \
|
||||
saveStreamReadBytesVita(&(stream)->platform, buf, len)
|
||||
#define saveStreamWriteBytesPlatform(stream, buf, len) \
|
||||
saveStreamWriteBytesVita(&(stream)->platform, buf, len)
|
||||
#define saveStreamSeekPlatform(stream, pos) \
|
||||
saveStreamSeekVita(&(stream)->platform, pos)
|
||||
@@ -1,77 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "save/save.h"
|
||||
#include "save/savestreamvita.h"
|
||||
|
||||
errorret_t saveStreamOpenReadVita(
|
||||
savestreamvita_t *p, bool_t *found, const uint8_t slot
|
||||
) {
|
||||
char_t path[SAVE_VITA_PATH_MAX];
|
||||
snprintf(path, SAVE_VITA_PATH_MAX, SAVE_VITA_FILE_FORMAT,
|
||||
SAVE_VITA_TITLE_ID, (uint32_t)slot
|
||||
);
|
||||
|
||||
p->fd = sceIoOpen(path, SCE_O_RDONLY, 0);
|
||||
*found = (p->fd >= 0);
|
||||
errorOk();
|
||||
}
|
||||
|
||||
errorret_t saveStreamOpenWriteVita(savestreamvita_t *p, const uint8_t slot) {
|
||||
char_t dir[SAVE_VITA_PATH_MAX];
|
||||
snprintf(dir, SAVE_VITA_PATH_MAX, SAVE_VITA_DIR_FORMAT,
|
||||
SAVE_VITA_TITLE_ID, (uint32_t)slot
|
||||
);
|
||||
sceIoMkdir(dir, 0777);
|
||||
|
||||
char_t path[SAVE_VITA_PATH_MAX];
|
||||
snprintf(path, SAVE_VITA_PATH_MAX, SAVE_VITA_FILE_FORMAT,
|
||||
SAVE_VITA_TITLE_ID, (uint32_t)slot
|
||||
);
|
||||
|
||||
p->fd = sceIoOpen(path, SCE_O_WRONLY | SCE_O_CREAT | SCE_O_TRUNC, 0777);
|
||||
if(p->fd < 0) {
|
||||
errorThrow(
|
||||
"Failed to open Vita save file for writing: slot %u", (uint32_t)slot
|
||||
);
|
||||
}
|
||||
errorOk();
|
||||
}
|
||||
|
||||
void saveStreamCloseVita(savestreamvita_t *p) {
|
||||
if(p->fd >= 0) {
|
||||
sceIoClose(p->fd);
|
||||
p->fd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
errorret_t saveStreamReadBytesVita(
|
||||
savestreamvita_t *p, void *buf, const size_t len
|
||||
) {
|
||||
int32_t read = sceIoRead(p->fd, buf, (SceSize)len);
|
||||
if(read != (int32_t)len) {
|
||||
errorThrow("Unexpected end of Vita save file");
|
||||
}
|
||||
errorOk();
|
||||
}
|
||||
|
||||
errorret_t saveStreamWriteBytesVita(
|
||||
savestreamvita_t *p, const void *buf, const size_t len
|
||||
) {
|
||||
int32_t written = sceIoWrite(p->fd, buf, (SceSize)len);
|
||||
if(written != (int32_t)len) {
|
||||
errorThrow("Failed to write Vita save data");
|
||||
}
|
||||
errorOk();
|
||||
}
|
||||
|
||||
errorret_t saveStreamSeekVita(savestreamvita_t *p, const size_t pos) {
|
||||
if(sceIoLseek(p->fd, (SceOff)pos, SCE_SEEK_SET) < 0) {
|
||||
errorThrow("Failed to seek in Vita save file");
|
||||
}
|
||||
errorOk();
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "error/error.h"
|
||||
#include <psp2/io/fcntl.h>
|
||||
#include <psp2/io/stat.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct {
|
||||
SceUID fd;
|
||||
} savestreamvita_t;
|
||||
|
||||
/**
|
||||
* Opens a Vita save data file for reading.
|
||||
*
|
||||
* @param p Stream to initialize.
|
||||
* @param found Set to true if the file exists, false if it does not.
|
||||
* @param slot Save slot index.
|
||||
* @return An error if the open fails for a reason other than missing file.
|
||||
*/
|
||||
errorret_t saveStreamOpenReadVita(
|
||||
savestreamvita_t *p, bool_t *found, const uint8_t slot
|
||||
);
|
||||
|
||||
/**
|
||||
* Opens a Vita save data file for writing, creating or truncating it.
|
||||
* Creates the save data directory if it does not already exist.
|
||||
*
|
||||
* @param p Stream to initialize.
|
||||
* @param slot Save slot index.
|
||||
* @return An error if the file cannot be opened for writing.
|
||||
*/
|
||||
errorret_t saveStreamOpenWriteVita(savestreamvita_t *p, const uint8_t slot);
|
||||
|
||||
/**
|
||||
* Closes the file descriptor held by the stream.
|
||||
*
|
||||
* @param p Stream to close.
|
||||
*/
|
||||
void saveStreamCloseVita(savestreamvita_t *p);
|
||||
|
||||
/**
|
||||
* Reads len bytes from the stream into buf.
|
||||
*
|
||||
* @param p Active stream.
|
||||
* @param buf Destination buffer.
|
||||
* @param len Number of bytes to read.
|
||||
* @return An error if fewer than len bytes are available.
|
||||
*/
|
||||
errorret_t saveStreamReadBytesVita(
|
||||
savestreamvita_t *p, void *buf, const size_t len
|
||||
);
|
||||
|
||||
/**
|
||||
* Writes len bytes from buf into the stream.
|
||||
*
|
||||
* @param p Active stream.
|
||||
* @param buf Source buffer.
|
||||
* @param len Number of bytes to write.
|
||||
* @return An error if the write fails.
|
||||
*/
|
||||
errorret_t saveStreamWriteBytesVita(
|
||||
savestreamvita_t *p, const void *buf, const size_t len
|
||||
);
|
||||
|
||||
/**
|
||||
* Seeks to an absolute byte position within the stream.
|
||||
*
|
||||
* @param p Active stream.
|
||||
* @param pos Target byte offset from the start of the file.
|
||||
* @return An error if the seek fails.
|
||||
*/
|
||||
errorret_t saveStreamSeekVita(savestreamvita_t *p, const size_t pos);
|
||||
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "moduleplatformvita.h"
|
||||
|
||||
#define modulePlatformPlatform modulePlatformVita
|
||||
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "script/scriptmanager.h"
|
||||
|
||||
void modulePlatformVita(void) {
|
||||
scriptManagerExec("VITA = true\n", NULL);
|
||||
}
|
||||
Reference in New Issue
Block a user