Skip to content

Commit 32e0d54

Browse files
committed
Build and add ninja.dll: This is a commonly used hack by performance-tuning tools like Pulse, allowing CPU frequency adjustment without the need to install additional software. This update loads ninja.dll and sets the CPU's multiplier and pre-scaler to run at 130 MHz instead of the default 104 MHz. While further testing is recommended, it is expected to function reliably.
1 parent 023ba31 commit 32e0d54

File tree

4 files changed

+155
-7
lines changed

4 files changed

+155
-7
lines changed

.github/workflows/nokia-ngage.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ jobs:
6363
Copy-Item ${{ env.NGAGESDK }}\projects\kagekero\build\kagekero.app NGAGE\System\Apps\kagekero\
6464
Copy-Item ${{ env.NGAGESDK }}\projects\kagekero\build\kagekero.exe NGAGE\System\Apps\kagekero\
6565
Copy-Item ${{ env.NGAGESDK }}\projects\kagekero\build\kagekero.rsc NGAGE\System\Apps\kagekero\
66+
Copy-Item ${{ env.NGAGESDK }}\projects\kagekero\build\ninja.dll NGAGE\System\Apps\kagekero\
6667
Copy-Item ${{ env.NGAGESDK }}\projects\kagekero\export\data.pfs NGAGE\System\Apps\kagekero\
6768
shell: pwsh
6869

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,19 @@ if(NGAGESDK)
7272
${EPOC_LIB}/avkon.lib
7373
)
7474

75+
set(ninja_dll_sources
76+
src/ninja.cpp
77+
)
78+
79+
set(ninja_dll_libs "")
80+
7581
add_library(kagekero_app STATIC ${kagekero_app_sources})
7682
build_dll(kagekero_app kagekero app 0x1000007a 0x100039ce 0x1badc0de "${kagekero_app_libs}")
7783
build_aif(${CMAKE_CURRENT_SOURCE_DIR}/res kagekero 0x1badc0de)
7884
build_resource(${CMAKE_CURRENT_SOURCE_DIR}/res kagekero "")
85+
86+
add_library(ninja_dll STATIC ${ninja_dll_sources})
87+
build_dll(ninja_dll ninja dll 0x1000007a 0x100039e6 0xa00013bd "${ninja_dll_libs}")
7988
endif()
8089

8190
# Host-only: build packer and pack data.pfs

src/ngage_appui.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,28 @@ void CNGageAppUi::ConstructL()
2323
AddToStackL(iAppView);
2424
}
2525

26+
_LIT(KDllName, "E:\\System\\Apps\\kagekero\\ninja.dll");
27+
2628
CNGageAppUi::CNGageAppUi()
2729
{
2830
RProcess Proc;
2931

3032
iAppView = NULL;
3133

32-
if (KErrNone == Proc.Create(_L("E:\\System\\Apps\\kagekero\\kagekero.exe"), _L("")))
34+
RLibrary lib;
35+
if (lib.Load(KDllName) == KErrNone)
3336
{
34-
TRequestStatus status;
35-
Proc.Logon(status);
36-
Proc.Resume();
37-
User::WaitForRequest(status);
38-
Proc.Close();
39-
Exit();
37+
UserSvr::ChangeLocale(lib);
38+
lib.Close();
39+
if (KErrNone == Proc.Create(_L("E:\\System\\Apps\\kagekero\\kagekero.exe"), _L("")))
40+
{
41+
TRequestStatus status;
42+
Proc.Logon(status);
43+
Proc.Resume();
44+
User::WaitForRequest(status);
45+
Proc.Close();
46+
Exit();
47+
}
4048
}
4149
else
4250
{

src/ninja.cpp

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
#include <e32def.h>
2+
#include <e32std.h>
3+
4+
GLDEF_C TInt E32Dll(TDllReason /* aReason*/)
5+
{
6+
return KErrNone;
7+
}
8+
9+
__declspec(naked) EXPORT_C void set_reg16(TUint16 aValue, TUint anAddr)
10+
{
11+
__asm("mov\tr2, #0x58000000");
12+
__asm("strh\tr0, [r2, r1]");
13+
__asm("mov\tpc, lr");
14+
}
15+
16+
__declspec(naked) EXPORT_C void set_reg32(TUint32 aValue, TUint anAddr)
17+
{
18+
__asm("mov\tr2, #0x58000000");
19+
__asm("str\tr0, [r2, r1]");
20+
__asm("mov\tpc, lr");
21+
}
22+
23+
EXPORT_C TInt locltest_1(void)
24+
{
25+
return 0;
26+
}
27+
28+
EXPORT_C TInt locltest_2(void)
29+
{
30+
return 0;
31+
}
32+
33+
EXPORT_C TInt locltest_3(void)
34+
{
35+
return 0;
36+
}
37+
38+
EXPORT_C TInt locltest_4(void)
39+
{
40+
return 0;
41+
}
42+
43+
EXPORT_C TInt locltest_5(void)
44+
{
45+
return 0;
46+
}
47+
48+
EXPORT_C TInt locltest_6(void)
49+
{
50+
return 0;
51+
}
52+
53+
EXPORT_C TInt locltest_7(void)
54+
{
55+
return 0;
56+
}
57+
58+
EXPORT_C TInt locltest_8(void)
59+
{
60+
return 0;
61+
}
62+
63+
EXPORT_C TInt locltest_9(void)
64+
{
65+
return 0;
66+
}
67+
68+
EXPORT_C TInt locltest_10(void)
69+
{
70+
return 0;
71+
}
72+
73+
EXPORT_C TInt locltest_11(void)
74+
{
75+
return 0;
76+
}
77+
78+
EXPORT_C TInt locltest_12(void)
79+
{
80+
return 0;
81+
}
82+
83+
EXPORT_C TInt locltest_13(void)
84+
{
85+
return 0;
86+
}
87+
88+
EXPORT_C TInt locltest_14(void)
89+
{
90+
return 0;
91+
}
92+
93+
EXPORT_C TInt locltest_15(void)
94+
{
95+
return 0;
96+
}
97+
98+
EXPORT_C TInt locltest_16(void)
99+
{
100+
set_reg16(0x2bf0, 0x149000);
101+
set_reg32(0x180f8000, 0x120018);
102+
set_reg32(0x8028000, 0x120014);
103+
104+
return 0;
105+
}
106+
107+
EXPORT_C TInt locltest_17(void)
108+
{
109+
return 0;
110+
}
111+
112+
EXPORT_C TInt locltest_18(void)
113+
{
114+
return 0;
115+
}
116+
117+
EXPORT_C TInt locltest_19(void)
118+
{
119+
return 0;
120+
}
121+
122+
EXPORT_C TInt locltest_20(void)
123+
{
124+
return 0;
125+
}
126+
127+
EXPORT_C TInt locltest_21(void)
128+
{
129+
return 0;
130+
}

0 commit comments

Comments
 (0)