Homebrew Homebrew Development

Snailface

My frothing demand for 3ds homebrew is increasing
Member
Joined
Sep 20, 2010
Messages
4,324
Trophies
2
Age
40
Location
Engine Room with Cyan, watching him learn.
XP
2,256
For those that don't know, you should be updating object positioning based on the time it takes to render each frame, and not using any sort of wait/lag commands to adjust game fps. Common practice is to create a render() method to draw everything and an update(deltaTime) method to modify the positioning based on the deltaTime (time since last render in seconds). That way, in your update() method you can put stuff like obj.x += 10*deltaTime; and make it so the object moves 10 pixels per second regardless of lag. Of course, this requires float precision (some use double).

Example of basic game loop: https://github.com/cpp3ds/cpp3ds/blob/master/src/Scene.cpp
And that's a problem for two reasons. My build environment doesn't like float calculations and gives me errors when I use them. Second, arm9 has no hard float so it's slow. This it especially a problem with 3ds arm9 because, for some reason, it benchmarks much slower than nds arm9. I can't wait to see how slow floats would be if they actually worked. :P
 

TheCruel

Developer
Banned
Joined
Dec 6, 2013
Messages
1,350
Trophies
2
XP
3,131
Country
United States
I can't wait to see how slow floats would be if they actually worked. :P
I have it working, and I can post an example if I can get the time. The 3ds lib I'm making is based around floating point operations, but I'm trying to position it to be ready for when arm11 is accessible.

It's not slow enough not to use it imo, especially considering how it's much slower to do drawing operations in general (especially screen clearing). But once we can finally use the GPU, none of this will be a problem. I've frankly given up on trying to make games without decent hardware access lol.
 

tjexp

Happy New Year!
Member
Joined
May 20, 2012
Messages
743
Trophies
1
Location
England
XP
409
Country
Wait wut?
https://twitter.com/smealum/status/433254129868099584

anim2.gif
 

CalebW

Fellow Temper
Member
Joined
Jun 29, 2012
Messages
638
Trophies
0
Location
Texas
XP
545
Country
United States
For those that don't know, you should be updating object positioning based on the time it takes to render each frame, and not using any sort of wait/lag commands to adjust game fps. Common practice is to create a render() method to draw everything and an update(deltaTime) method to modify the positioning based on the deltaTime (time since last render in seconds). That way, in your update() method you can put stuff like obj.x += 10*deltaTime; and make it so the object moves 10 pixels per second regardless of lag. Of course, this requires float precision (some use double).

Example of basic game loop: https://github.com/cpp3ds/cpp3ds/blob/master/src/Scene.cpp
What are the contents of the GetSystemTick() function? As we are unable to use any predefined functions I'm assuming you included that in a header file somewhere?
 

TheCruel

Developer
Banned
Joined
Dec 6, 2013
Messages
1,350
Trophies
2
XP
3,131
Country
United States

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
What are the contents of the GetSystemTick() function? As we are unable to use any predefined functions I'm assuming you included that in a header file somewhere?

Who said that? GetSystemTick() uses SVC, and almost all the SVC (partially documented on 3DBrew) can be teoretically used if you know, or can figure out, in which register load parameters.

I still think that in Smealun example there are a lot of small treasures that we can use (and I'm testing a couple of that B-)). Stay tuned ...
 

YoshiInAVoid

Banned!
Banned
Joined
Jan 10, 2011
Messages
560
Trophies
1
Website
google.com
XP
465
Country
Would it be possible to dump DS cards (not 3DS) by extracting part of the RAM?

EDIT: Just remembered that you have to close the game (free it from RAM) before you can return to the home menu.
 

st4rk

nah
Member
Joined
Feb 11, 2014
Messages
542
Trophies
0
Website
st4rk.net
XP
815
Country
Brazil
right, the arm9 has no vfp unit. the arm11 has a vfp unit for each core.

Thank you for answer, we need acess the ARM11...

i'm working on a "memory view" to check the memory of 3DS and trying decrypt the Launcher of gateway 3DS to study :P


YoshiInAVoid
Maybe no, i think the game is not completely loaded in the RAM, some part are loaded, and another part are loaded when is necessary =P
 

YoshiInAVoid

Banned!
Banned
Joined
Jan 10, 2011
Messages
560
Trophies
1
Website
google.com
XP
465
Country
I don't want to run Smealum's code, I just want to run ARM 11 code.

I think I've managed to compile a blank ARM 11 binary, and changed my arm 9's entry to this (copies pre-compiled ARM 11 binary to the same place GW copies ARM 11 code to):

Code:
#include "main.h"
#include <string.h>
 
extern char binary_arm11_bin_start[];
extern char binary_arm11_bin_size[];
 
void c_entry() {
    memcpy((void *)0x1FFF4000, binary_arm11_bin_start, (size_t)binary_arm11_bin_size);
    main();
}

No idea how to get ARM 11 to execute it now though; and I'm not even sure if I've done everything correct so far. :wacko:

Don't think I'll be running ARM 11 any time soon :hateit:
 

Snailface

My frothing demand for 3ds homebrew is increasing
Member
Joined
Sep 20, 2010
Messages
4,324
Trophies
2
Age
40
Location
Engine Room with Cyan, watching him learn.
XP
2,256
  • Like
Reactions: YoshiInAVoid

YoshiInAVoid

Banned!
Banned
Joined
Jan 10, 2011
Messages
560
Trophies
1
Website
google.com
XP
465
Country
Ta very much love!

Here's my dual Makefile (ARM 9 folder and ARM 11 folder) incase anyone wants my template (even though it can't actually run ARM 11 yet). It requires OpenSSL to create the GWLauncher.dat.

Code:
GWLauncher.dat: ROPLauncher.dat
    openssl enc -aes-128-cbc -K 580006192800C5F0FBFB04E06A682088 -iv 00000000000000000000000000000000 -in ROPLauncher.dat -out GWLauncher.dat
 
ROPLauncher.dat: ARM9/arm9.bin
    cat lib/p3ds/exp.bin arm9.bin lib/p3ds/pad.bin > ROPLauncher.dat
 
ARM9/arm9.bin: ARM9/bin/arm11.o
    $(MAKE) -C arm9
 
ARM9/bin/arm11.o: ARM11/arm11.bin
    ld -r -b binary -o ARM9/arm11.o ARM11/arm11.bin
 
ARM11/arm11.bin:
    $(MAKE) -C arm11

Just include this in your arm9 somewhere:

Code:
extern char binary_arm11_bin_start[];
extern char binary_arm11_bin_size[];

And you can go copying ARM 11 code around willing nilly like so:

Code:
memcpy((void *)0x1FFF4000, binary_arm11_bin_start, (size_t)binary_arm11_bin_size);
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    BakerMan @ BakerMan: it looks like a little kids' game, and bunny (welcome btw) is looking for an uncensor patch +1