Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
GrapheneCt authored Aug 3, 2020
1 parent aa57215 commit d286527
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 14 deletions.
22 changes: 16 additions & 6 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
endif()

project(ThreadOptimizer)

include("${DOLCESDK}/share/dolce.cmake" REQUIRED)

dolce_gen_libs(SceLibKernel_stubs
SceLibKernel.yml
LIB SceLibKernel_stub_weak)
set(VITA_APP_NAME "Thread Optimizer")
set(VITA_TITLEID "THRDOPTMA")
set(VITA_VERSION "01.00")
set(VITA_TITLEID "GRVA00004")
set(VITA_VERSION "01.50")
set(DOLCE_MKSFOEX_FLAGS "${DOLCE_MKSFOEX_FLAGS} -d PARENTAL_LEVEL=0")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -Wno-unused-variable -Wno-unused-but-set-variable -Wno-format-truncation")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -Wno-unused-variable -Wno-unused-but-set-variable -Wno-format-truncation -fno-builtin")

link_directories(
${CMAKE_CURRENT_BINARY_DIR}
Expand All @@ -30,6 +35,7 @@ target_link_libraries(${PROJECT_NAME}
SceLibKernel_stub
SceSysmem_stub
SceKernelThreadMgr_stub
SceProcessMgr_stub
SceAppMgr_stub
ScePvf_stub
SceDisplay_stub
Expand All @@ -41,17 +47,21 @@ target_link_libraries(${PROJECT_NAME}
SceJpeg_stub
SceLibc_stub
SceFios2_stub
SceKernelDmacMgr_stub
SceDbg_stub
SceLibKernel_stub_weak
)

#set_target_properties(${PROJECT_NAME}
# PROPERTIES LINK_FLAGS "-nostdlib"
#)
set_target_properties(${PROJECT_NAME}
PROPERTIES LINK_FLAGS "-nostdlib"
)

dolce_create_self(eboot.bin ${PROJECT_NAME} UNSAFE)

dolce_create_vpk(${PROJECT_NAME}.vpk ${VITA_TITLEID} eboot.bin
VERSION ${VITA_VERSION}
NAME ${VITA_APP_NAME}
CONTENT_ID_NAME THREADOPTIMIZER0
FILE sce_sys/icon0.png sce_sys/icon0.png
FILE sce_sys/pic0.png sce_sys/pic0.png
FILE sce_sys/livearea/contents/bg.png sce_sys/livearea/contents/bg.png
Expand Down
26 changes: 26 additions & 0 deletions app/SceLibKernel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 2
firmware: 3.60
modules:
SceLibKernel:
nid: 0xF9C9C52F
libraries:
SceRtabi:
kernel: false
nid: 0xA941943F
functions:
SceRtabi_0D4F0635: 0x0D4F0635
SceRtabi_141BC4CE: 0x141BC4CE
SceRtabi_21FF67B9: 0x21FF67B9 # variation of SceRtabi_CBDA815C
SceRtabi_317B3774: 0x317B3774
__aeabi_idivmod: 0x38D62D60 # 32/32 -> 32 signed division
SceRtabi_5024AB91: 0x5024AB91
SceRtabi_609CA961: 0x609CA961
SceRtabi_67104054: 0x67104054 # 32/32 -> 64 signed division
SceRtabi_6BB838EF: 0x6BB838EF
SceRtabi_6CBB0E84: 0x6CBB0E84
SceRtabi_A5DB3A86: 0xA5DB3A86 # variation of SceRtabi_CBDA815C
SceRtabi_AA1F1B50: 0xAA1F1B50
__aeabi_uidivmod: 0xC33391D1 # ??? 32/32 -> 32 unsigned division
SceRtabi_CBDA815C: 0xCBDA815C
SceRtabi_CDF7708E: 0xCDF7708E
__aeabi_uidiv: 0xFB311F87 # ??? 32/32 -> 32 unsigned division
16 changes: 8 additions & 8 deletions app/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
#include <math.h>
#include <psp2/kernel/threadmgr.h>
#include <psp2/kernel/sysmem.h>
#include <psp2/kernel/processmgr.h>
#include <psp2/kernel/clib.h>
#include <psp2/sysmodule.h>
#include <psp2/message_dialog.h>
#include <psp2/io/fcntl.h>
#include <psp2/common_dialog.h>
#include <psp2/io/dirent.h>
#include <psp2/kernel/iofilemgr.h>
#include <psp2/ctrl.h>
#include <vita2d_sys.h>

Expand Down Expand Up @@ -236,16 +236,16 @@ unsigned int drawThreadEdit(unsigned int selection_prev)
else if (ONPRESS(SCE_CTRL_CROSS)) {
switch (selection) {
case 0:
snapshot.affinity[selection_prev] ^= SCE_KERNEL_CPU_MASK_USER_0;
sceKernelAtomicXorAndGet32(&snapshot.affinity[selection_prev], SCE_KERNEL_CPU_MASK_USER_0);
break;
case 1:
snapshot.affinity[selection_prev] ^= SCE_KERNEL_CPU_MASK_USER_1;
sceKernelAtomicXorAndGet32(&snapshot.affinity[selection_prev], SCE_KERNEL_CPU_MASK_USER_1);
break;
case 2:
snapshot.affinity[selection_prev] ^= SCE_KERNEL_CPU_MASK_USER_2;
sceKernelAtomicXorAndGet32(&snapshot.affinity[selection_prev], SCE_KERNEL_CPU_MASK_USER_2);
break;
case 3:
snapshot.affinity[selection_prev] ^= SCE_KERNEL_CPU_MASK_USER_3;
sceKernelAtomicXorAndGet32(&snapshot.affinity[selection_prev], SCE_KERNEL_CPU_MASK_USER_3);
break;
}
}
Expand Down Expand Up @@ -658,7 +658,7 @@ unsigned int drawMainSelect(void)
return selection + page_modifier;
}

int main(void)
void _start(unsigned int args, void *argp)
{
ScePVoid clibm_base;
SceUID clib_heap = sceKernelAllocMemBlock("ClibHeap", SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, CLIB_HEAP_SIZE, NULL);
Expand Down Expand Up @@ -724,6 +724,6 @@ int main(void)
selection = drawThreadEdit(selection);
goto repeat_1;

return 0;
sceKernelExitProcess(0);
}

2 changes: 2 additions & 0 deletions app/src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ typedef struct ThreadOptimizerSnapshot {
int priority[MAX_THREADS];
int affinity[MAX_THREADS];
} ThreadOptimizerSnapshot;

int32_t sceKernelAtomicXorAndGet32(int32_t* dst, int32_t val);

0 comments on commit d286527

Please sign in to comment.