Homebrew Problems compiling SnemulDS

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
Hello everyone.
I have done a few code modifications in @Coto 's SnemulDS program, and now, when I'm trying to compile it, there's an error that is shown in last step (compiling SnemulDS). I'm using Lubuntu 16 x86 and I have followed in detail those guides:
1. Recompile Newlib 2.1: https://bitbucket.org/Coto88/newlib-nds/src/master/newlib-nds/README.MD
2. Compile ToolchainGenericDS: https://bitbucket.org/Coto88/toolchaingenericds/src/master/README.md
3. Compile SnemulDS project: https://bitbucket.org/Coto88/snemulds/src/master/README.md

After a lot of messages doing things (compiling, checking, etc...) makefile of SnemulDS is showing following error:
#error "ToolchainGenericDS SDK builds ARM9DLDI TGDS Binaries! Make sure it builds ARM7DLDI TGDS Binaries!"

The last message of makefile for ToolchainGenericDS is not seem an error:
Leaving Linking phase. ./build/libtoolchaingen9.a
so I suppose that it has been correctly compiled... Where could be the problem?
Thanks!
 

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
It means TGDS is building ARM9DLDI binaries, while SnemulDS is targeting an ARM7DLDI binary.

You need to :
cd /SnemulDS
make clean
cd /ToolchainGenericDS/src
make clean

then open global_settings.h in
ToolchainGenericDS/src/common/

comment out, like this:
//#define ARM9_DLDI

and define, like this:
#define ARM7_DLDI

Then open ipcfifoTGDSUser.h in
SnemulDS/common

define, like this: (if it's commented out, re-define it)
#define SNEMULDS_ARM7_DLDI

then rebuild (make) ToolchainGenericDS again
and then rebuild (make) SnemulDS again.

The output Binary should be an ARM7DLDI SnemulDS binary (which has sound in my R4igold.cc and DSTTi card)

if for some reason (after several retries) you aren't getting any sound, notify me here.



Also, very important!

You should re-do the steps in a Windows environment (a Virtual Machine works as well), because the TGDS for Linux environment uses ARM-NONE-EABI instead the older ARM-EABI TGDS projects, of which, are recommended to be compiled with.

Check this out:
https://forums.nesdev.com/viewtopic.php?f=23&t=18659
(second post)
 
Last edited by Coto,
  • Like
Reactions: JeanDrEaD

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
Wow, firstly, thanks for your time writing those instructions for me, @Coto
I want to compile SnemulDS to replace .nds program included in TwilightMenu++ (last version), in order to use it in a NDSi console through SD card. I say that because I'm a bit lost between ARM7 and ARM9 versions, and I don't know when it's necessary to use first or second version.

Edit:
I have compiled successfully ARM9 version of master branch (included my modifications in main.c) but I have discovered that ARM9 version starts on R4i card (NDSL) and SD (NDSi), but only a few rom work and emulation freezes after a few seconds...

My mods: https://bitbucket.org/JDSft/snemulds_gbmacro/commits/a85fbf81da66d8c4d47df468705300baa2a879ea
 
Last edited by xonn,
  • Like
Reactions: Deleted User

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
Yeah, that's great. But if I were you i'd have simply updated/added an entry to snemul.cfg for re-scaling and swap screens, instead of adding a "JDsft" + hardcoded values. Because then you could have created a pull request to master branch so i'd have had them included

Also ARM7DLDI is likely to work on NDSi through SD (AFAIK ARM9DLDI shouldn't work). And so far the Binary that outputs "sound" is the one that will work and will prevent freezes. There are plenty of games to test, that init the APU correctly, such as Kirby Dreamland Course (which means, sometimes an ARM7DLDI outputs sound, or/and an ARM9DLDI outputs sound). This is a known bug in SnemulDS so you'll have to recompile ARM7DLDI and ARM9DLDI separately and see which one has sound for you flashcard
 
Last edited by Coto,

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
Yeah, that's great. But if I were you i'd have simply updated/added an entry to snemul.cfg for re-scaling and swap screens, instead of adding a "JDsft" + hardcoded values. Because then you could have created a pull request to master branch so i'd have had them included

You know the program better than me, of course. The problem is that in a SD card using TwilighMenu++ is not possible to load cfg file according to this user: https://gbatemp.net/threads/ds-i-3d...menu-replacement.472200/page-465#post-8924739
I'm new at this, so I didn't know that could be possible to ask for changes, but now that I know, I'm going to delete branch and create the request.
Thanks again!

Edit: How can I create a pull request? :unsure:
 
Last edited by xonn,

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
You know the program better than me, of course. The problem is that in a SD card using TwilighMenu++ is not possible to load cfg file according to this user: https://gbatemp.net/threads/ds-i-3d...menu-replacement.472200/page-465#post-8924739
I'm new at this, so I didn't know that could be possible to ask for changes, but now that I know, I'm going to delete branch and create the request.
Thanks again!

Edit: How can I create a pull request? :unsure:

Dude we are all learning! I'm sure you'll do just fine.


What I do when I make a mistake (when a commit was sent to origin/master branch), and I want to take that commit back and re-do things:

1)
Focus on the features to add in SnemulDS. But since the current branch is "dirty"... we go to step 2.

2)
Feel free to either rollback/ammend the recent commits to your branch (these are GIT commands, you can read more about that), so you re-commit to your branch "snemulds_gbmacro" until your current most recent commit has all the changes we want ( which re-does the step 1) maybe a few times).

Then, when ready go to 3)


3)
Then, once you have all your commits in "snemulds_gbmacro", log-in through Atlassian web and reach your repository, then, follow these steps to create a pull request:

https://confluence.atlassian.com/bitbucket/create-a-pull-request-to-merge-your-change-774243413.html



...

So you do the local changes, and create a pull request, and I will add it to master branch!

So, welcome aboard!
 
Last edited by Coto,

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
One question, related to code.
Why arm7 main.c file does not contains the same functions than arm9 main.c? If both programs are the same and support screen swap using key combination, where is this functionality in arm7 version?
 

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
One question, related to code.
Why arm7 main.c file does not contains the same functions than arm9 main.c? If both programs are the same and support screen swap using key combination, where is this functionality in arm7 version?

Welcome to the NintendoDS world, where everything feels 90-ish, yet having more or less post 2000 hardware stuff (which opens up posibilities for coding more great stuff) and packing together technology very similar to a SNES (such as the VRAM layout) and on top of that you get 3D.

First of all ARM7 can be executed from EWRAM but that means ARM9 can't access such memory. Besides that, by design, ARM7 is targeted to run ARM7-specific hardware. For that you need an Operating System to handle all these tasks using very little memory, thus, IWRAM is meant for ARM7 cores but it is scarse. So, the NDS requires an OS that runs on ARM7 and ARM9 separately.

ARM9 has lots of ram to spare, so you can add debugging and memory allocation things in there. Also PPU (x2) runs on ARM9 as well.
By design this means ARM9 takes the 2D/3D graphics processing, while ARM7 handles the input, the wifi, the sound (and maybe other things, it helps to offload ARM9 processes, but requires to write IPC-like mailing methods to syncronize a process that runs on ARM9 and requires a specific ARM7 task to be done).

So when you read TGDS ARM7 binaries, these add all the described earlier, same goes for TGDS ARM9 binaries. Emulators will need to run on ARM9 because ARM9 has way much more access to graphics hardware which is used quite often in emulation stuff. While the sound can be externalized to ARM7 (but it is much more tricky to perform, unless you are used to writing sound drivers and you can code your own effects, you know, things you'd see in specific sound engines such as Pokemon Diamond/Pearl and Chrono Trigger.
 
  • Like
Reactions: xonn

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
bf... Ok. A two-headed monster to deal with, great for a noob.
I think I'm going to leave DS programming for the future, I need time to do that and for now, it's impossible.
Thanks again for your time, explanations and patience :yay:
 
  • Like
Reactions: banjo2

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
bf... Ok. A two-headed monster to deal with, great for a noob.
I think I'm going to leave DS programming for the future, I need time to do that and for now, it's impossible.
Thanks again for your time, explanations and patience :yay:

I mean it isn't that complex (in fact, it helps to understand the more complex modern SMP CPUs). Also TGDS saves most headaches for you to get started right into coding. Also it's not that I don't want to take your request, but I know great programmers from spain, so I thought "hey maybe this guy has the coding skillz too".
 
Last edited by Coto,
  • Like
Reactions: banjo2

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain

Great! Thanks a lot.
To create a good GBA Macro version, would be great to modify the way the user swap screens, because now it's a bit messy. Some ideas that I want to implement in NeoDS:
- Switch screens just after a rom loads.
- Restore screens everytime the user pauses the game and swap again when unpause (this is not viable in SNES, because there are a lot of games that shows a menu in pause mode)
- Swap screen when touching screen, like in NESDS emulator

EDIT: I have discovered that touch menu is still active when lower screen is touched, you should disable when is on upper screen.
 

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
Great! Thanks a lot.
To create a good GBA Macro version, would be great to modify the way the user swap screens, because now it's a bit messy.
Some ideas that I want to implement in NeoDS:
- Switch screens just after a rom loads.
- Restore screens everytime the user pauses the game and swap again when unpause (this is not viable in SNES, because there are a lot of games that shows a menu in pause mode)
- Swap screen when touching screen, like in NESDS emulator

But I think a buttom combo is much better than config. What if you don't have access to a PC? Even a touchscreen based screen swap is not appropiate. What if the touchscreen is broken?

Anyway, I will add/restore the screen swap bit to config. I have plenty of time today.

EDIT: I have discovered that touch menu is still active when lower screen is touched, you should disable when is on upper screen.
I will fix it.
 
Last edited by Coto,

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
Yes, using touchscreen as trigger is not a solution, I only was giving ideas.
Talking about a GBA mod, users will need to set lower screen as main screen, yes or yes. So an autoswap just after rom load is a good idea.
After that, the user only do swap if he/she wants to change settings, and this is not something frequent. But I propose to change current method to another easier, for example, select+start? L+R? Another one easier to remember.
PD: And if a temporary pop-up appears at the beginning of the emulation, remembering the way to swap?

Just some ideas [emoji6]
 

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
Then next time, you could add a "some suggestions", because I read that as actual bugs in the source code. And I am helping you out. Just so you know.
 

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
Then next time, you could add a "some suggestions", because I read that as actual bugs in the source code. And I am helping you out. Just so you know.
This is not the correct thread to give suggestions, you're right.That was totally an offtopic, sorry.
 

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
Last edited by Coto,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    I @ idonthave: :)