mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-19 13:51:16 +00:00
clang-format
This commit is contained in:
parent
78893bbeac
commit
3958762721
@ -1,13 +1,12 @@
|
|||||||
#include <stdint.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#include <psp2/kernel/threadmgr.h>
|
#include <psp2/kernel/threadmgr.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C"
|
||||||
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
typedef struct SceFiosBuffer {
|
typedef struct SceFiosBuffer {
|
||||||
void* pPtr;
|
void* pPtr;
|
||||||
size_t length;
|
size_t length;
|
||||||
@ -15,8 +14,7 @@ typedef struct SceFiosBuffer {
|
|||||||
|
|
||||||
#define SCE_FIOS_THREAD_TYPES 3
|
#define SCE_FIOS_THREAD_TYPES 3
|
||||||
|
|
||||||
typedef struct SceFiosParams
|
typedef struct SceFiosParams {
|
||||||
{
|
|
||||||
uint32_t initialized : 1;
|
uint32_t initialized : 1;
|
||||||
uint32_t paramsSize : 15;
|
uint32_t paramsSize : 15;
|
||||||
uint32_t pathMax : 16;
|
uint32_t pathMax : 16;
|
||||||
@ -60,16 +58,21 @@ typedef struct SceFiosParams
|
|||||||
#define SCE_FIOS_DECOMPRESSOR_THREAD_DEFAULT_STACKSIZE (16 * 1024)
|
#define SCE_FIOS_DECOMPRESSOR_THREAD_DEFAULT_STACKSIZE (16 * 1024)
|
||||||
#define SCE_FIOS_CALLBACK_THREAD_DEFAULT_STACKSIZE (8 * 1024)
|
#define SCE_FIOS_CALLBACK_THREAD_DEFAULT_STACKSIZE (8 * 1024)
|
||||||
|
|
||||||
#define SCE_FIOS_PARAMS_INITIALIZER { 0, sizeof(SceFiosParams), 0, 0, \
|
#define SCE_FIOS_PARAMS_INITIALIZER \
|
||||||
2, 2, \
|
{ \
|
||||||
0, 0, \
|
0, sizeof(SceFiosParams), 0, 0, 2, 2, 0, 0, (256 * 1024), 2, 0, 0, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, {0, 0}, \
|
||||||
(256*1024), \
|
|
||||||
2, 0, 0, 0, 0, 0, \
|
|
||||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
|
|
||||||
NULL, NULL, NULL, \
|
NULL, NULL, NULL, \
|
||||||
{ SCE_FIOS_IO_THREAD_DEFAULT_PRIORITY, SCE_FIOS_DECOMPRESSOR_THREAD_DEFAULT_PRIORITY, SCE_FIOS_CALLBACK_THREAD_DEFAULT_PRIORITY }, \
|
{SCE_FIOS_IO_THREAD_DEFAULT_PRIORITY, \
|
||||||
{ SCE_FIOS_IO_THREAD_DEFAULT_AFFINITY, SCE_FIOS_DECOMPRESSOR_THREAD_DEFAULT_AFFINITY, SCE_FIOS_CALLBACK_THREAD_DEFAULT_AFFINITY}, \
|
SCE_FIOS_DECOMPRESSOR_THREAD_DEFAULT_PRIORITY, \
|
||||||
{ SCE_FIOS_IO_THREAD_DEFAULT_STACKSIZE, SCE_FIOS_DECOMPRESSOR_THREAD_DEFAULT_STACKSIZE, SCE_FIOS_CALLBACK_THREAD_DEFAULT_STACKSIZE}}
|
SCE_FIOS_CALLBACK_THREAD_DEFAULT_PRIORITY}, \
|
||||||
|
{SCE_FIOS_IO_THREAD_DEFAULT_AFFINITY, \
|
||||||
|
SCE_FIOS_DECOMPRESSOR_THREAD_DEFAULT_AFFINITY, \
|
||||||
|
SCE_FIOS_CALLBACK_THREAD_DEFAULT_AFFINITY}, \
|
||||||
|
{ \
|
||||||
|
SCE_FIOS_IO_THREAD_DEFAULT_STACKSIZE, SCE_FIOS_DECOMPRESSOR_THREAD_DEFAULT_STACKSIZE, \
|
||||||
|
SCE_FIOS_CALLBACK_THREAD_DEFAULT_STACKSIZE \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
#define SCE_FIOS_IO_THREAD 0
|
#define SCE_FIOS_IO_THREAD 0
|
||||||
#define SCE_FIOS_DECOMPRESSOR_THREAD 1
|
#define SCE_FIOS_DECOMPRESSOR_THREAD 1
|
||||||
@ -82,40 +85,32 @@ typedef struct SceFiosParams
|
|||||||
|
|
||||||
#define SCE_FIOS_ALIGN_UP(val, align) (((val) + ((align) -1)) & ~((align) -1))
|
#define SCE_FIOS_ALIGN_UP(val, align) (((val) + ((align) -1)) & ~((align) -1))
|
||||||
|
|
||||||
#define SCE_FIOS_STORAGE_SIZE(num, size) \
|
#define SCE_FIOS_STORAGE_SIZE(num, size) (((num) * (size)) + SCE_FIOS_ALIGN_UP(SCE_FIOS_ALIGN_UP((num), 8) / 8, 8))
|
||||||
(((num) * (size)) + SCE_FIOS_ALIGN_UP(SCE_FIOS_ALIGN_UP((num), 8) / 8, 8))
|
|
||||||
|
|
||||||
#define SCE_FIOS_DH_STORAGE_SIZE(numDHs, pathMax) \
|
#define SCE_FIOS_DH_STORAGE_SIZE(numDHs, pathMax) SCE_FIOS_STORAGE_SIZE(numDHs, SCE_FIOS_DH_SIZE + pathMax)
|
||||||
SCE_FIOS_STORAGE_SIZE(numDHs, SCE_FIOS_DH_SIZE + pathMax)
|
|
||||||
|
|
||||||
#define SCE_FIOS_FH_STORAGE_SIZE(numFHs,pathMax) \
|
#define SCE_FIOS_FH_STORAGE_SIZE(numFHs, pathMax) SCE_FIOS_STORAGE_SIZE(numFHs, SCE_FIOS_FH_SIZE + pathMax)
|
||||||
SCE_FIOS_STORAGE_SIZE(numFHs, SCE_FIOS_FH_SIZE + pathMax)
|
|
||||||
|
|
||||||
#define SCE_FIOS_OP_STORAGE_SIZE(numOps,pathMax) \
|
#define SCE_FIOS_OP_STORAGE_SIZE(numOps, pathMax) SCE_FIOS_STORAGE_SIZE(numOps, SCE_FIOS_OP_SIZE + pathMax)
|
||||||
SCE_FIOS_STORAGE_SIZE(numOps, SCE_FIOS_OP_SIZE + pathMax)
|
|
||||||
|
|
||||||
#define SCE_FIOS_CHUNK_STORAGE_SIZE(numChunks) \
|
#define SCE_FIOS_CHUNK_STORAGE_SIZE(numChunks) SCE_FIOS_STORAGE_SIZE(numChunks, SCE_FIOS_CHUNK_SIZE)
|
||||||
SCE_FIOS_STORAGE_SIZE(numChunks, SCE_FIOS_CHUNK_SIZE)
|
|
||||||
|
|
||||||
int sceFiosInitialize(SceFiosParams* params);
|
int sceFiosInitialize(SceFiosParams* params);
|
||||||
|
|
||||||
|
|
||||||
typedef int64_t SceFiosTime;
|
typedef int64_t SceFiosTime;
|
||||||
|
|
||||||
typedef int32_t SceFiosHandle;
|
typedef int32_t SceFiosHandle;
|
||||||
|
|
||||||
typedef SceFiosHandle SceFiosFH;
|
typedef SceFiosHandle SceFiosFH;
|
||||||
|
|
||||||
typedef struct SceFiosOpenParams
|
typedef struct SceFiosOpenParams {
|
||||||
{
|
|
||||||
uint32_t openFlags : 16;
|
uint32_t openFlags : 16;
|
||||||
uint32_t opFlags : 16;
|
uint32_t opFlags : 16;
|
||||||
uint32_t reserved;
|
uint32_t reserved;
|
||||||
SceFiosBuffer buffer;
|
SceFiosBuffer buffer;
|
||||||
} SceFiosOpenParams;
|
} SceFiosOpenParams;
|
||||||
|
|
||||||
typedef struct SceFiosOpAttr
|
typedef struct SceFiosOpAttr {
|
||||||
{
|
|
||||||
SceFiosTime deadline;
|
SceFiosTime deadline;
|
||||||
void* pCallback;
|
void* pCallback;
|
||||||
void* pCallbackContext;
|
void* pCallbackContext;
|
||||||
@ -126,10 +121,13 @@ typedef struct SceFiosOpAttr
|
|||||||
void* pReserved;
|
void* pReserved;
|
||||||
} SceFiosOpAttr;
|
} SceFiosOpAttr;
|
||||||
|
|
||||||
|
int sceFiosFHOpenWithModeSync(
|
||||||
int sceFiosFHOpenWithModeSync(const SceFiosOpAttr *pAttr, SceFiosFH *pOutFH, const char *pPath, const SceFiosOpenParams *pOpenParams, int32_t nativeMode);
|
const SceFiosOpAttr* pAttr,
|
||||||
|
SceFiosFH* pOutFH,
|
||||||
|
const char* pPath,
|
||||||
|
const SceFiosOpenParams* pOpenParams,
|
||||||
|
int32_t nativeMode
|
||||||
|
);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,14 +21,14 @@
|
|||||||
#include "pafstd.h"
|
#include "pafstd.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C"
|
||||||
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
New types
|
New types
|
||||||
---------------------------------------------------------------------------*/
|
---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
@brief Dictionary object
|
@brief Dictionary object
|
||||||
@ -47,7 +47,6 @@ typedef struct _dictionary_ {
|
|||||||
unsigned* hash; /** List of hash values for keys */
|
unsigned* hash; /** List of hash values for keys */
|
||||||
} dictionary;
|
} dictionary;
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
Function prototypes
|
Function prototypes
|
||||||
---------------------------------------------------------------------------*/
|
---------------------------------------------------------------------------*/
|
||||||
@ -106,7 +105,6 @@ void dictionary_del(dictionary * vd);
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
const char* dictionary_get(const dictionary* d, const char* key, const char* def);
|
const char* dictionary_get(const dictionary* d, const char* key, const char* def);
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
@brief Set a value in a dictionary.
|
@brief Set a value in a dictionary.
|
||||||
@ -148,7 +146,6 @@ int dictionary_set(dictionary * vd, const char * key, const char * val);
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
void dictionary_unset(dictionary* d, const char* key);
|
void dictionary_unset(dictionary* d, const char* key);
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
@brief Dump a dictionary to an opened file pointer.
|
@brief Dump a dictionary to an opened file pointer.
|
||||||
|
|||||||
@ -15,10 +15,12 @@
|
|||||||
---------------------------------------------------------------------------*/
|
---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "dictionary.h"
|
#include "dictionary.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C"
|
||||||
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
@ -54,7 +56,6 @@ void iniparser_set_error_callback(int (*errback)(const char *, ...));
|
|||||||
|
|
||||||
int iniparser_getnsec(const dictionary* d);
|
int iniparser_getnsec(const dictionary* d);
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
@brief Get name for section n in a dictionary.
|
@brief Get name for section n in a dictionary.
|
||||||
@ -72,7 +73,6 @@ int iniparser_getnsec(const dictionary * d);
|
|||||||
|
|
||||||
const char* iniparser_getsecname(const dictionary* d, int n);
|
const char* iniparser_getsecname(const dictionary* d, int n);
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
@brief Save a dictionary to a loadable ini file
|
@brief Save a dictionary to a loadable ini file
|
||||||
@ -148,7 +148,6 @@ int iniparser_getsecnkeys(const dictionary * d, const char * s);
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
const char** iniparser_getseckeys(const dictionary* d, const char* s, const char** keys);
|
const char** iniparser_getseckeys(const dictionary* d, const char* s, const char** keys);
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
@brief Get the string associated to a key
|
@brief Get the string associated to a key
|
||||||
@ -331,7 +330,6 @@ double iniparser_getdouble(const dictionary * d, const char * key, double notfou
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
int iniparser_getboolean(const dictionary* d, const char* key, int notfound);
|
int iniparser_getboolean(const dictionary* d, const char* key, int notfound);
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
@brief Set an entry in a dictionary.
|
@brief Set an entry in a dictionary.
|
||||||
@ -347,7 +345,6 @@ int iniparser_getboolean(const dictionary * d, const char * key, int notfound);
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
int iniparser_set(dictionary* ini, const char* entry, const char* val);
|
int iniparser_set(dictionary* ini, const char* entry, const char* val);
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
@brief Delete an entry in a dictionary
|
@brief Delete an entry in a dictionary
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
#ifndef __PAFSTD__
|
#ifndef __PAFSTD__
|
||||||
#define __PAFSTD__
|
#define __PAFSTD__
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
#include <paf/std/stdlib.h>
|
#include <paf/std/stdlib.h>
|
||||||
#include <paf/std/string.h>
|
#include <paf/std/string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <inttypes.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define malloc sce_paf_malloc
|
#define malloc sce_paf_malloc
|
||||||
#define memcpy sce_paf_memcpy
|
#define memcpy sce_paf_memcpy
|
||||||
@ -18,19 +18,21 @@
|
|||||||
|
|
||||||
// _ctype_ isnt called that in scelibc, so just stub the functions that are needed
|
// _ctype_ isnt called that in scelibc, so just stub the functions that are needed
|
||||||
|
|
||||||
inline int _is_space(char c) {
|
inline int _is_space(char c)
|
||||||
return (c == ' ' || c == '\f' || c == '\n' ||
|
{
|
||||||
c == '\r' || c == '\t' || c == '\v');
|
return (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v');
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int _to_lower(int c) {
|
inline int _to_lower(int c)
|
||||||
|
{
|
||||||
if (c >= 'A' && c <= 'Z') {
|
if (c >= 'A' && c <= 'Z') {
|
||||||
return c + ('a' - 'A');
|
return c + ('a' - 'A');
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int _is_digit(int c) {
|
inline int _is_digit(int c)
|
||||||
|
{
|
||||||
return (c >= '0' && c <= '9');
|
return (c >= '0' && c <= '9');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
#include "pafinc.h"
|
|
||||||
#include <app_settings.h>
|
|
||||||
#include <psp2/kernel/clib.h>
|
|
||||||
#include <psp2/io/fcntl.h>
|
|
||||||
#include <psp2/sysmodule.h>
|
|
||||||
#include <psp2/kernel/modulemgr.h>
|
|
||||||
#include <psp2/appmgr.h>
|
|
||||||
|
|
||||||
#include "fios2.h"
|
#include "fios2.h"
|
||||||
|
#include "pafinc.h"
|
||||||
|
|
||||||
|
#include <app_settings.h>
|
||||||
#include <iniparser.h>
|
#include <iniparser.h>
|
||||||
|
#include <psp2/appmgr.h>
|
||||||
|
#include <psp2/io/fcntl.h>
|
||||||
|
#include <psp2/kernel/clib.h>
|
||||||
|
#include <psp2/kernel/modulemgr.h>
|
||||||
|
#include <psp2/sysmodule.h>
|
||||||
|
|
||||||
const char* g_iniPath = "ux0:data/isledecomp/isle/isle.ini";
|
const char* g_iniPath = "ux0:data/isledecomp/isle/isle.ini";
|
||||||
|
|
||||||
@ -16,7 +16,6 @@ paf::Plugin* g_configPlugin;
|
|||||||
sce::AppSettings* g_appSettings;
|
sce::AppSettings* g_appSettings;
|
||||||
sce::AppSettings::Interface* g_appSetIf;
|
sce::AppSettings::Interface* g_appSetIf;
|
||||||
|
|
||||||
|
|
||||||
struct Config {
|
struct Config {
|
||||||
paf::string m_base_path;
|
paf::string m_base_path;
|
||||||
paf::string m_cd_path;
|
paf::string m_cd_path;
|
||||||
@ -36,7 +35,8 @@ struct Config {
|
|||||||
int m_max_actors;
|
int m_max_actors;
|
||||||
float m_frame_delta;
|
float m_frame_delta;
|
||||||
|
|
||||||
void Init() {
|
void Init()
|
||||||
|
{
|
||||||
m_frame_delta = 10.0f;
|
m_frame_delta = 10.0f;
|
||||||
m_transition_type = 3; // 3: Mosaic
|
m_transition_type = 3; // 3: Mosaic
|
||||||
m_wide_view_angle = true;
|
m_wide_view_angle = true;
|
||||||
@ -52,7 +52,8 @@ struct Config {
|
|||||||
m_max_actors = 20;
|
m_max_actors = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadIni() {
|
void LoadIni()
|
||||||
|
{
|
||||||
dictionary* dict = iniparser_load(g_iniPath);
|
dictionary* dict = iniparser_load(g_iniPath);
|
||||||
if (!dict) {
|
if (!dict) {
|
||||||
dict = dictionary_new(0);
|
dict = dictionary_new(0);
|
||||||
@ -60,7 +61,9 @@ struct Config {
|
|||||||
|
|
||||||
#define GET_INT(x, name) x = iniparser_getint(dict, name, x)
|
#define GET_INT(x, name) x = iniparser_getint(dict, name, x)
|
||||||
#define GET_FLOAT(x, name) x = iniparser_getdouble(dict, name, x)
|
#define GET_FLOAT(x, name) x = iniparser_getdouble(dict, name, x)
|
||||||
#define GET_STRING(x, name) x = iniparser_getstring(dict, name, x.c_str()); sceClibPrintf("%s: %s\n", name, x.c_str())
|
#define GET_STRING(x, name) \
|
||||||
|
x = iniparser_getstring(dict, name, x.c_str()); \
|
||||||
|
sceClibPrintf("%s: %s\n", name, x.c_str())
|
||||||
#define GET_BOOLEAN(x, name) x = iniparser_getboolean(dict, name, x)
|
#define GET_BOOLEAN(x, name) x = iniparser_getboolean(dict, name, x)
|
||||||
|
|
||||||
GET_STRING(m_base_path, "isle:diskpath");
|
GET_STRING(m_base_path, "isle:diskpath");
|
||||||
@ -98,16 +101,19 @@ struct Config {
|
|||||||
iniparser_freedict(dict);
|
iniparser_freedict(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SaveIni() {
|
bool SaveIni()
|
||||||
|
{
|
||||||
dictionary* dict = dictionary_new(0);
|
dictionary* dict = dictionary_new(0);
|
||||||
|
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
#define SetIniBool(NAME, VALUE) iniparser_set(dict, NAME, VALUE ? "true" : "false")
|
#define SetIniBool(NAME, VALUE) iniparser_set(dict, NAME, VALUE ? "true" : "false")
|
||||||
#define SetIniInt(NAME, VALUE) { \
|
#define SetIniInt(NAME, VALUE) \
|
||||||
|
{ \
|
||||||
sceClibPrintf(buffer, "%d", VALUE); \
|
sceClibPrintf(buffer, "%d", VALUE); \
|
||||||
iniparser_set(dict, NAME, buffer); \
|
iniparser_set(dict, NAME, buffer); \
|
||||||
}
|
}
|
||||||
#define SetIniFloat(NAME, VALUE) { \
|
#define SetIniFloat(NAME, VALUE) \
|
||||||
|
{ \
|
||||||
sceClibPrintf(buffer, "%f", VALUE); \
|
sceClibPrintf(buffer, "%f", VALUE); \
|
||||||
iniparser_set(dict, NAME, buffer); \
|
iniparser_set(dict, NAME, buffer); \
|
||||||
}
|
}
|
||||||
@ -160,19 +166,19 @@ struct Config {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToSettings(sce::AppSettings* appSettings) {
|
void ToSettings(sce::AppSettings* appSettings)
|
||||||
|
{
|
||||||
appSettings->SetString("data_path", this->m_base_path.c_str());
|
appSettings->SetString("data_path", this->m_base_path.c_str());
|
||||||
appSettings->SetString("save_path", this->m_save_path.c_str());
|
appSettings->SetString("save_path", this->m_save_path.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FromSettings(sce::AppSettings* appSettings) {
|
void FromSettings(sce::AppSettings* appSettings) {}
|
||||||
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Config g_config;
|
Config g_config;
|
||||||
|
|
||||||
paf::Plugin* load_config_plugin(paf::Framework* paf_fw) {
|
paf::Plugin* load_config_plugin(paf::Framework* paf_fw)
|
||||||
|
{
|
||||||
paf::Plugin::InitParam pluginParam;
|
paf::Plugin::InitParam pluginParam;
|
||||||
pluginParam.name = "config_plugin";
|
pluginParam.name = "config_plugin";
|
||||||
pluginParam.caller_name = "__main__";
|
pluginParam.caller_name = "__main__";
|
||||||
@ -185,7 +191,8 @@ paf::Plugin* load_config_plugin(paf::Framework* paf_fw) {
|
|||||||
return paf_fw->FindPlugin("config_plugin");
|
return paf_fw->FindPlugin("config_plugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
int load_app_settings_plugin() {
|
int load_app_settings_plugin()
|
||||||
|
{
|
||||||
paf::Plugin::InitParam pluginParam;
|
paf::Plugin::InitParam pluginParam;
|
||||||
sceSysmoduleLoadModuleInternal(SCE_SYSMODULE_INTERNAL_BXCE);
|
sceSysmoduleLoadModuleInternal(SCE_SYSMODULE_INTERNAL_BXCE);
|
||||||
sceSysmoduleLoadModuleInternal(SCE_SYSMODULE_INTERNAL_INI_FILE_PROCESSOR);
|
sceSysmoduleLoadModuleInternal(SCE_SYSMODULE_INTERNAL_INI_FILE_PROCESSOR);
|
||||||
@ -207,13 +214,15 @@ int load_app_settings_plugin() {
|
|||||||
|
|
||||||
bool do_launch = false;
|
bool do_launch = false;
|
||||||
|
|
||||||
void save_and_exit() {
|
void save_and_exit()
|
||||||
|
{
|
||||||
g_config.FromSettings(g_appSettings);
|
g_config.FromSettings(g_appSettings);
|
||||||
g_config.SaveIni();
|
g_config.SaveIni();
|
||||||
g_fw->RequestShutdown();
|
g_fw->RequestShutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
void save_and_launch() {
|
void save_and_launch()
|
||||||
|
{
|
||||||
g_config.FromSettings(g_appSettings);
|
g_config.FromSettings(g_appSettings);
|
||||||
g_config.SaveIni();
|
g_config.SaveIni();
|
||||||
g_fw->RequestShutdown();
|
g_fw->RequestShutdown();
|
||||||
@ -222,17 +231,14 @@ void save_and_launch() {
|
|||||||
|
|
||||||
void CBOnStartPageTransition(const char* elementId, int32_t type)
|
void CBOnStartPageTransition(const char* elementId, int32_t type)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBOnPageActivate(const char* elementId, int32_t type)
|
void CBOnPageActivate(const char* elementId, int32_t type)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBOnPageDeactivate(const char* elementId, int32_t type)
|
void CBOnPageDeactivate(const char* elementId, int32_t type)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CBOnCheckVisible(const char* elementId, bool* pIsVisible)
|
int32_t CBOnCheckVisible(const char* elementId, bool* pIsVisible)
|
||||||
@ -291,7 +297,8 @@ int32_t CBOnGetSurface(paf::graph::Surface **surf, const char *elementId)
|
|||||||
return SCE_OK;
|
return SCE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void open_settings() {
|
void open_settings()
|
||||||
|
{
|
||||||
g_config.Init();
|
g_config.Init();
|
||||||
g_config.LoadIni();
|
g_config.LoadIni();
|
||||||
g_config.ToSettings(g_appSettings);
|
g_config.ToSettings(g_appSettings);
|
||||||
@ -321,7 +328,6 @@ void open_settings() {
|
|||||||
g_appSetIf->ShowFooter();
|
g_appSetIf->ShowFooter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define MAX_PATH_LENGTH 256
|
#define MAX_PATH_LENGTH 256
|
||||||
|
|
||||||
static int64_t g_OpStorage[SCE_FIOS_OP_STORAGE_SIZE(64, MAX_PATH_LENGTH) / sizeof(int64_t) + 1];
|
static int64_t g_OpStorage[SCE_FIOS_OP_STORAGE_SIZE(64, MAX_PATH_LENGTH) / sizeof(int64_t) + 1];
|
||||||
@ -329,7 +335,8 @@ static int64_t g_ChunkStorage[SCE_FIOS_CHUNK_STORAGE_SIZE(1024) / sizeof(int64_t
|
|||||||
static int64_t g_FHStorage[SCE_FIOS_FH_STORAGE_SIZE(1024, MAX_PATH_LENGTH) / sizeof(int64_t) + 1];
|
static int64_t g_FHStorage[SCE_FIOS_FH_STORAGE_SIZE(1024, MAX_PATH_LENGTH) / sizeof(int64_t) + 1];
|
||||||
static int64_t g_DHStorage[SCE_FIOS_DH_STORAGE_SIZE(32, MAX_PATH_LENGTH) / sizeof(int64_t) + 1];
|
static int64_t g_DHStorage[SCE_FIOS_DH_STORAGE_SIZE(32, MAX_PATH_LENGTH) / sizeof(int64_t) + 1];
|
||||||
|
|
||||||
void init_fios2() {
|
void init_fios2()
|
||||||
|
{
|
||||||
sceSysmoduleLoadModule(SCE_SYSMODULE_FIOS2);
|
sceSysmoduleLoadModule(SCE_SYSMODULE_FIOS2);
|
||||||
SceFiosParams params = SCE_FIOS_PARAMS_INITIALIZER;
|
SceFiosParams params = SCE_FIOS_PARAMS_INITIALIZER;
|
||||||
params.opStorage.pPtr = g_OpStorage;
|
params.opStorage.pPtr = g_OpStorage;
|
||||||
@ -355,7 +362,8 @@ void init_fios2() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int paf_main(void) {
|
int paf_main(void)
|
||||||
|
{
|
||||||
init_fios2();
|
init_fios2();
|
||||||
|
|
||||||
paf::Framework::InitParam fwParam;
|
paf::Framework::InitParam fwParam;
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
#include "pafinc.h"
|
#include "pafinc.h"
|
||||||
|
|
||||||
#include <psp2/kernel/clib.h>
|
#include <psp2/kernel/clib.h>
|
||||||
#include <psp2/kernel/modulemgr.h>
|
#include <psp2/kernel/modulemgr.h>
|
||||||
#include <psp2/kernel/processmgr.h>
|
#include <psp2/kernel/processmgr.h>
|
||||||
|
|||||||
@ -508,7 +508,9 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
|
|||||||
case SDL_EVENT_FINGER_DOWN:
|
case SDL_EVENT_FINGER_DOWN:
|
||||||
case SDL_EVENT_FINGER_UP:
|
case SDL_EVENT_FINGER_UP:
|
||||||
case SDL_EVENT_FINGER_CANCELED:
|
case SDL_EVENT_FINGER_CANCELED:
|
||||||
if(event->tfinger.touchID == 2) return SDL_APP_CONTINUE;
|
if (event->tfinger.touchID == 2) {
|
||||||
|
return SDL_APP_CONTINUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -685,8 +685,12 @@ GXMRenderer::GXMRenderer(DWORD width, DWORD height, DWORD msaaSamples)
|
|||||||
m_virtualHeight = height;
|
m_virtualHeight = height;
|
||||||
|
|
||||||
SceGxmMultisampleMode msaaMode = SCE_GXM_MULTISAMPLE_NONE;
|
SceGxmMultisampleMode msaaMode = SCE_GXM_MULTISAMPLE_NONE;
|
||||||
if(msaaSamples == 2) msaaMode = SCE_GXM_MULTISAMPLE_2X;
|
if (msaaSamples == 2) {
|
||||||
if(msaaSamples == 4) msaaMode = SCE_GXM_MULTISAMPLE_4X;
|
msaaMode = SCE_GXM_MULTISAMPLE_2X;
|
||||||
|
}
|
||||||
|
if (msaaSamples == 4) {
|
||||||
|
msaaMode = SCE_GXM_MULTISAMPLE_4X;
|
||||||
|
}
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
if (!gxm) {
|
if (!gxm) {
|
||||||
@ -944,7 +948,8 @@ void GXMRenderer::DeferredDelete(int index)
|
|||||||
this->m_buffers_delete[index].clear();
|
this->m_buffers_delete[index].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int calculateMipLevels(int width, int height) {
|
static int calculateMipLevels(int width, int height)
|
||||||
|
{
|
||||||
if (width <= 0 || height <= 0) {
|
if (width <= 0 || height <= 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -952,8 +957,11 @@ static int calculateMipLevels(int width, int height) {
|
|||||||
return floor(log2(maxDim)) + 1;
|
return floor(log2(maxDim)) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nextPowerOf2(int n) {
|
static int nextPowerOf2(int n)
|
||||||
if (n <= 0) return 1;
|
{
|
||||||
|
if (n <= 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
n--;
|
n--;
|
||||||
n |= n >> 1;
|
n |= n >> 1;
|
||||||
n |= n >> 2;
|
n |= n >> 2;
|
||||||
@ -964,7 +972,6 @@ static int nextPowerOf2(int n) {
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void convertTextureMetadata(
|
static void convertTextureMetadata(
|
||||||
SDL_Surface* surface,
|
SDL_Surface* surface,
|
||||||
bool isUi,
|
bool isUi,
|
||||||
@ -1043,7 +1050,8 @@ static void convertTextureMetadata(
|
|||||||
*textureSize = totalSize;
|
*textureSize = totalSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void copySurfaceToGxmARGB888(SDL_Surface* src, uint8_t* textureData, size_t dstStride, size_t mipLevels) {
|
void copySurfaceToGxmARGB888(SDL_Surface* src, uint8_t* textureData, size_t dstStride, size_t mipLevels)
|
||||||
|
{
|
||||||
uint8_t* currentLevelData = textureData;
|
uint8_t* currentLevelData = textureData;
|
||||||
uint32_t currentLevelWidth = src->w;
|
uint32_t currentLevelWidth = src->w;
|
||||||
uint32_t currentLevelHeight = src->h;
|
uint32_t currentLevelHeight = src->h;
|
||||||
@ -1065,11 +1073,15 @@ void copySurfaceToGxmARGB888(SDL_Surface* src, uint8_t* textureData, size_t dstS
|
|||||||
sceGxmTransferDownscale(
|
sceGxmTransferDownscale(
|
||||||
SCE_GXM_TRANSFER_FORMAT_U8U8U8U8_ABGR, // src format
|
SCE_GXM_TRANSFER_FORMAT_U8U8U8U8_ABGR, // src format
|
||||||
currentLevelData, // src address
|
currentLevelData, // src address
|
||||||
0, 0, currentLevelWidth, currentLevelHeight, // x,y,w,h
|
0,
|
||||||
|
0,
|
||||||
|
currentLevelWidth,
|
||||||
|
currentLevelHeight, // x,y,w,h
|
||||||
currentLevelSrcStride, // stride
|
currentLevelSrcStride, // stride
|
||||||
SCE_GXM_TRANSFER_FORMAT_U8U8U8U8_ABGR, // dst format
|
SCE_GXM_TRANSFER_FORMAT_U8U8U8U8_ABGR, // dst format
|
||||||
nextLevelData, // dst address
|
nextLevelData, // dst address
|
||||||
0, 0, // x,y
|
0,
|
||||||
|
0, // x,y
|
||||||
currentLevelDestStride, // stride
|
currentLevelDestStride, // stride
|
||||||
NULL, // sync
|
NULL, // sync
|
||||||
SCE_GXM_TRANSFER_FRAGMENT_SYNC, // flag
|
SCE_GXM_TRANSFER_FRAGMENT_SYNC, // flag
|
||||||
@ -1082,7 +1094,15 @@ void copySurfaceToGxmARGB888(SDL_Surface* src, uint8_t* textureData, size_t dstS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void copySurfaceToGxmIndexed8(DirectDrawSurfaceImpl* surface, SDL_Surface* src, uint8_t* textureData, size_t dstStride, uint8_t* paletteData, size_t mipLevels) {
|
void copySurfaceToGxmIndexed8(
|
||||||
|
DirectDrawSurfaceImpl* surface,
|
||||||
|
SDL_Surface* src,
|
||||||
|
uint8_t* textureData,
|
||||||
|
size_t dstStride,
|
||||||
|
uint8_t* paletteData,
|
||||||
|
size_t mipLevels
|
||||||
|
)
|
||||||
|
{
|
||||||
LPDIRECTDRAWPALETTE _palette;
|
LPDIRECTDRAWPALETTE _palette;
|
||||||
surface->GetPalette(&_palette);
|
surface->GetPalette(&_palette);
|
||||||
auto palette = static_cast<DirectDrawPaletteImpl*>(_palette);
|
auto palette = static_cast<DirectDrawPaletteImpl*>(_palette);
|
||||||
@ -1111,11 +1131,15 @@ void copySurfaceToGxmIndexed8(DirectDrawSurfaceImpl* surface, SDL_Surface* src,
|
|||||||
sceGxmTransferDownscale(
|
sceGxmTransferDownscale(
|
||||||
SCE_GXM_TRANSFER_FORMAT_U8_R, // src format
|
SCE_GXM_TRANSFER_FORMAT_U8_R, // src format
|
||||||
currentLevelData, // src address
|
currentLevelData, // src address
|
||||||
0, 0, currentLevelWidth, currentLevelHeight, // x,y,w,h
|
0,
|
||||||
|
0,
|
||||||
|
currentLevelWidth,
|
||||||
|
currentLevelHeight, // x,y,w,h
|
||||||
currentLevelSrcStride, // stride
|
currentLevelSrcStride, // stride
|
||||||
SCE_GXM_TRANSFER_FORMAT_U8_R, // dst format
|
SCE_GXM_TRANSFER_FORMAT_U8_R, // dst format
|
||||||
nextLevelData, // dst address
|
nextLevelData, // dst address
|
||||||
0, 0, // x,y
|
0,
|
||||||
|
0, // x,y
|
||||||
currentLevelDestStride, // stride
|
currentLevelDestStride, // stride
|
||||||
NULL, // sync
|
NULL, // sync
|
||||||
SCE_GXM_TRANSFER_FRAGMENT_SYNC, // flag
|
SCE_GXM_TRANSFER_FRAGMENT_SYNC, // flag
|
||||||
@ -1130,7 +1154,13 @@ void copySurfaceToGxmIndexed8(DirectDrawSurfaceImpl* surface, SDL_Surface* src,
|
|||||||
palette->Release();
|
palette->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void copySurfaceToGxm(DirectDrawSurfaceImpl* surface, uint8_t* textureData, size_t dstStride, size_t paletteOffset, size_t mipLevels)
|
void copySurfaceToGxm(
|
||||||
|
DirectDrawSurfaceImpl* surface,
|
||||||
|
uint8_t* textureData,
|
||||||
|
size_t dstStride,
|
||||||
|
size_t paletteOffset,
|
||||||
|
size_t mipLevels
|
||||||
|
)
|
||||||
{
|
{
|
||||||
SDL_Surface* src = surface->m_surface;
|
SDL_Surface* src = surface->m_surface;
|
||||||
|
|
||||||
@ -1215,7 +1245,15 @@ Uint32 GXMRenderer::GetTextureId(IDirect3DRMTexture* iTexture, bool isUi, float
|
|||||||
copySurfaceToGxm(surface, (uint8_t*) textureData, textureStride, paletteOffset, mipLevels);
|
copySurfaceToGxm(surface, (uint8_t*) textureData, textureStride, paletteOffset, mipLevels);
|
||||||
|
|
||||||
SceGxmTexture gxmTexture;
|
SceGxmTexture gxmTexture;
|
||||||
SCE_ERR(sceGxmTextureInitLinear, &gxmTexture, textureData, gxmTextureFormat, textureWidth, textureHeight, mipLevels);
|
SCE_ERR(
|
||||||
|
sceGxmTextureInitLinear,
|
||||||
|
&gxmTexture,
|
||||||
|
textureData,
|
||||||
|
gxmTextureFormat,
|
||||||
|
textureWidth,
|
||||||
|
textureHeight,
|
||||||
|
mipLevels
|
||||||
|
);
|
||||||
if (isUi) {
|
if (isUi) {
|
||||||
sceGxmTextureSetMinFilter(&gxmTexture, SCE_GXM_TEXTURE_FILTER_POINT);
|
sceGxmTextureSetMinFilter(&gxmTexture, SCE_GXM_TEXTURE_FILTER_POINT);
|
||||||
sceGxmTextureSetMagFilter(&gxmTexture, SCE_GXM_TEXTURE_FILTER_POINT);
|
sceGxmTextureSetMagFilter(&gxmTexture, SCE_GXM_TEXTURE_FILTER_POINT);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user