Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
GrapheneCt committed Nov 19, 2021
1 parent cb7720f commit 7a23265
Show file tree
Hide file tree
Showing 16 changed files with 961 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Prerequisites
*.d

# Object files
*.o
*.ko
*.obj
*.elf

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

# VDS
*.vs
eboot.bin
eboot2.bin
param.sfo
param2.sfo
PSVita_Debug
PSVita_Release
34 changes: 34 additions & 0 deletions AppSettings.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.1525
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libAppSettings", "AppSettings\AppSettings.vcxproj", "{7ECABF42-AC7D-4B8C-A5B3-8349746A6D3D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample", "sample\sample.vcxproj", "{EBE09354-473A-489D-BBF2-78F6D067A5E4}"
ProjectSection(ProjectDependencies) = postProject
{7ECABF42-AC7D-4B8C-A5B3-8349746A6D3D} = {7ECABF42-AC7D-4B8C-A5B3-8349746A6D3D}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|PSVita = Debug|PSVita
Release|PSVita = Release|PSVita
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7ECABF42-AC7D-4B8C-A5B3-8349746A6D3D}.Debug|PSVita.ActiveCfg = Debug|PSVita
{7ECABF42-AC7D-4B8C-A5B3-8349746A6D3D}.Debug|PSVita.Build.0 = Debug|PSVita
{7ECABF42-AC7D-4B8C-A5B3-8349746A6D3D}.Release|PSVita.ActiveCfg = Release|PSVita
{7ECABF42-AC7D-4B8C-A5B3-8349746A6D3D}.Release|PSVita.Build.0 = Release|PSVita
{EBE09354-473A-489D-BBF2-78F6D067A5E4}.Debug|PSVita.ActiveCfg = Debug|PSVita
{EBE09354-473A-489D-BBF2-78F6D067A5E4}.Debug|PSVita.Build.0 = Debug|PSVita
{EBE09354-473A-489D-BBF2-78F6D067A5E4}.Release|PSVita.ActiveCfg = Release|PSVita
{EBE09354-473A-489D-BBF2-78F6D067A5E4}.Release|PSVita.Build.0 = Release|PSVita
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1F61F31B-2A6B-4E9C-A040-8EE1CA627C82}
EndGlobalSection
EndGlobal
83 changes: 83 additions & 0 deletions AppSettings/AppSettings.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|PSVita">
<Configuration>Debug</Configuration>
<Platform>PSVita</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|PSVita">
<Configuration>Release</Configuration>
<Platform>PSVita</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="cif.cpp" />
<ClCompile Include="main.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="app_settings.h" />
<ClInclude Include="app_settings_internal.h" />
<ClInclude Include="main.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7ECABF42-AC7D-4B8C-A5B3-8349746A6D3D}</ProjectGuid>
<ProjectName>libAppSettings</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|PSVita'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|PSVita'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup Condition="'$(DebuggerFlavor)'=='PSVitaDebugger'" Label="OverrideDebuggerDefaults">
<!--LocalDebuggerCommand>$(TargetPath)</LocalDebuggerCommand-->
<!--LocalDebuggerReboot>false</LocalDebuggerReboot-->
<!--LocalDebuggerCommandArguments></LocalDebuggerCommandArguments-->
<!--LocalDebuggerTarget></LocalDebuggerTarget-->
<!--LocalDebuggerWorkingDirectory>$(ProjectDir)</LocalDebuggerWorkingDirectory-->
<!--LocalMappingFile></LocalMappingFile-->
<!--LocalRunCommandLine></LocalRunCommandLine-->
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|PSVita'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|PSVita'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|PSVita'">
<ClCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions);</PreprocessorDefinitions>
<GenerateDebugInformation>true</GenerateDebugInformation>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>$(SCE_PSP2_SDK_DIR)\target\include\vdsuite\user;$(SCE_PSP2_SDK_DIR)\target\include\vdsuite\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalDependencies>-lsnc;-lScePafTopLevel_stub_weak;-lScePafThread_stub_weak;-lScePafStdc_stub_weak;-lScePafMisc_stub_weak;-lScePafCommon_stub_weak;-lScePafGraphics_stub_weak;-lScePafResource_stub_weak;-lSceLibKernel_stub;-lSceSysmodule_stub;-lSceThreadmgr_stub;-lSceProcessmgr_stub;-lSceAppSettings_stub_weak;-lSceDbg_stub;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>--no-standard-libraries --no-required-files</AdditionalOptions>
<AdditionalLibraryDirectories>$(SCE_PSP2_SDK_DIR)\target\lib\vdsuite;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|PSVita'">
<ClCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions);</PreprocessorDefinitions>
<OptimizationLevel>Level2</OptimizationLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>$(SCE_PSP2_SDK_DIR)\target\include\vdsuite\user;$(SCE_PSP2_SDK_DIR)\target\include\vdsuite\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalDependencies>-lsnc;-lScePafTopLevel_stub_weak;-lScePafThread_stub_weak;-lScePafStdc_stub_weak;-lScePafMisc_stub_weak;-lScePafCommon_stub_weak;-lScePafGraphics_stub_weak;-lScePafResource_stub_weak;-lSceLibKernel_stub;-lSceSysmodule_stub;-lSceThreadmgr_stub;-lSceProcessmgr_stub;-lSceAppSettings_stub_weak;-lSceDbg_stub;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>--no-standard-libraries --no-required-files</AdditionalOptions>
<AdditionalLibraryDirectories>$(SCE_PSP2_SDK_DIR)\target\lib\vdsuite;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<Import Condition="'$(ConfigurationType)' == 'Makefile' and Exists('$(VCTargetsPath)\Platforms\$(Platform)\SCE.Makefile.$(Platform).targets')" Project="$(VCTargetsPath)\Platforms\$(Platform)\SCE.Makefile.$(Platform).targets" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
32 changes: 32 additions & 0 deletions AppSettings/AppSettings.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cxx;cc;s;asm</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="cif.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="main.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="app_settings.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="app_settings_internal.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions AppSettings/AppSettings.vcxproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
89 changes: 89 additions & 0 deletions AppSettings/app_settings.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#ifndef _APP_SETTINGS_H_
#define _APP_SETTINGS_H_

#ifdef __cplusplus
extern "C" {
#endif

typedef int(*AppSettingsIsElementVisibleCB)(const char *elementId, int *pIsVisible);
typedef int(*AppSettingsOnValueChangeCB)(const char *elementId, const char *newValue);
typedef wchar_t*(*AppSettingsGetStringCB)(const char *elementId);

typedef struct AppSettingsCallbacks {
AppSettingsIsElementVisibleCB isElemVisible; // Visibility check for element of app settings. Set IsVisible to 0 to hide element
AppSettingsOnValueChangeCB onValueChange; // Called when user selects new value for element of app settings. New value is saved in internal INI config automatically
AppSettingsGetStringCB getString; // Called when there is new request for string element value of app settings layout.
} AppSettingsCallbacks;

typedef struct AppSettingsInitParam {
char *configFilePath; // Path to XML app settings config/layout file
unsigned int iniSafememMaxSize; // Maximum amount of bytes that will be used out of safe memory to store internal INI config
unsigned int iniSafememOffset; // Offset in the safe memory where internal INI config will be stored
AppSettingsCallbacks callbacks; // Operation callbacks, see ::AppSettingsCallbacks
} AppSettingsInitParam;

/**
* Initialize app settings system.
* When this function is called, GXM must be uninitialized and all framebuffer operations must be paused.
*
* @param[in] pInitParam - structure containing app settings init params
*
* @return SCE_OK, <0 on error.
*/
int appSettingsInit(AppSettingsInitParam *pInitParam);

/**
* Terminate app settings system.
*
* @return SCE_OK, <0 on error.
*/
int appSettingsTerm();

/**
* Get integer value corresponding to set key.
*
* @param[in] key - key string
* @param[in] value - buffer to store value
* @param[in] defaultValue - value to use if key was not found
*
* @return SCE_OK, <0 on error.
*/
int appSettingsGetInt(const char *key, int *value, int defaultValue);

/**
* Set integer value key.
*
* @param[in] key - key string
* @param[in] value - key value
*
* @return SCE_OK, <0 on error.
*/
int appSettingsSetInt(const char *key, int value);

/**
* Open app settings dialog.
*
* @return SCE_OK, <0 on error.
*/
int appSettingsOpen();

/**
* Reset app settings.
* Useful if settings version has been changed.
*
* @return SCE_OK, <0 on error.
*/
int appSettingsReset();

/**
* Block caller thread until user closed app settings dialog.
*
* @return SCE_OK, <0 on error.
*/
int appSettingsWaitEnd();

#ifdef __cplusplus
}
#endif

#endif
15 changes: 15 additions & 0 deletions AppSettings/app_settings_internal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

typedef struct AppSettingsInitParam AppSettingsInitParam;

extern "C" {

__declspec (dllexport) int appSettingsInit(AppSettingsInitParam *pInitParam);
__declspec (dllexport) int appSettingsTerm();
__declspec (dllexport) int appSettingsGetInt(const char *key, int *value, int defaultValue);
__declspec (dllexport) int appSettingsSetInt(const char *key, int value);
__declspec (dllexport) int appSettingsOpen();
__declspec (dllexport) int appSettingsReset();
__declspec (dllexport) int appSettingsWaitEnd();

}
55 changes: 55 additions & 0 deletions AppSettings/cif.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include <kernel.h>
#include <paf.h>

#include "main.h"
#include "app_settings_internal.h"

extern "C" {

int __module_stop(SceSize argc, const void *args) {
return SCE_KERNEL_STOP_SUCCESS;
}

int __module_exit() {
return SCE_KERNEL_STOP_SUCCESS;
}

int __module_start(SceSize argc, void *args) {
return SCE_KERNEL_START_SUCCESS;
}

__declspec (dllexport) int appSettingsInit(AppSettingsInitParam *pInitParam)
{
return _appSettingsInit(pInitParam);
}

__declspec (dllexport) int appSettingsTerm()
{
return _appSettingsTerm();
}

__declspec (dllexport) int appSettingsGetInt(const char *key, int *value, int defaultValue)
{
return _appSettingsGetInt(key, value, defaultValue);
}

__declspec (dllexport) int appSettingsSetInt(const char *key, int value)
{
return _appSettingsSetInt(key, value);
}

__declspec (dllexport) int appSettingsOpen()
{
return _appSettingsOpen();
}

__declspec (dllexport) int appSettingsReset()
{
return _appSettingsReset();
}

__declspec (dllexport) int appSettingsWaitEnd()
{
return _appSettingsWaitEnd();
}
}
Loading

0 comments on commit 7a23265

Please sign in to comment.