Homebrew Adapt NeoDS to GameBoy Macro

  • Thread starter xonn
  • Start date
  • Views 6,784
  • Replies 35
  • Likes 4

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
Hello!
I have spent some hours trying to understand NeoDS 0.2.0 code for trying to make following modification: Force screen swap everytime the user press pause button (L shoulder) or a new rom is loaded.
The main objetive is allow using this great emulator in a GameBoy Macro.
I have created a branch of Yardape8000 original code and included some lines, but now I can't compile and check the result because I can't find the correct libnds version... Someone can help me?
Thanks in advance :)
 

NightScript

Well-Known Member
Member
Joined
Feb 7, 2016
Messages
951
Trophies
1
Age
20
XP
2,232
Country
United States
The correct versions to use is the following:
libnds-1.3.1
devkitARM_r21

If you're going to update it though, why spend your time looking for old libnds versions? Why not just update the application fully to make it compile on the latest toolchain?
 

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
Totally agree with you. However, the changes are only 3 new lines in the best case, so I prefer to check if I'm in the good way, and after that, perform the complete update.
One question, how do you have discovered the exact versions of libnds and devkitarm?
Thanks!

Edit: the problem now is where can I download those versions? :wacko:
 
Last edited by xonn,

Pk11

A catgirl with a DSi
Member
Joined
Jun 26, 2019
Messages
1,285
Trophies
1
Age
22
Location
米国
Website
pk11.us
XP
3,892
Country
United States
Totally agree with you. However, the changes are only 3 new lines in the best case, so I prefer to check if I'm in the good way, and after that, perform the complete update.
One question, how do you have discovered the exact versions of libnds and devkitarm?
Thanks!

Edit: the problem now is where can I download those versions? :wacko:
There's a lot here: Collection of old devkitPro versions

There's the right devkitARM for windows, not that old of a libnds though so you'll need to try the oldest they've got I guess...

The readme also says:
NeoDs uses a modified libfat which has a lookup table to vastly speed up seek times.
But doesn't say what's changed or where you can get that so they may cause problems...
Edit: nevermind it looks to have that in the arm9/source folder
 
  • Like
Reactions: banjo2

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
Thanks @Pk11 for the link. I have checked some libnds versions, but any of those are error free, so I have started the update process (I don't know how far I'll get, but let's try). From now, I'm only fixing errors, but I'll take note of all warnings messages too. All help is welcome!

[FIX] NeoAudio.c: SOUND_CR --> REG_SOUNDCNT
[FIX] NeoVideo.c: xdx --> hdx
[FIX] NeoVideo.c: ydy --> vdy
[FIX] NeoVideoFixed.arm.c: BLEND_AB --> REG_BLDALPHA
[FIX] NeoVideoFixed.arm.c: BLEND_CR --> REG_BLDCNT
[FIX?] template.c: TransferRegion undeclared --> line commented
[FIX] disc_io.c: can't --> cant
[FIX] filetime.c: #include <time.c> --> line added
[FIX] io_njsd.c: CARD_COMMAND --> REG_CARD_COMMAND
[FIX] io_njsd.c: CARD_CR1J --> REG_AUXSPICNTH
[FIX] io_njsd.c: CARD_CR2 --> REG_ROMCTRL
[FIX] io_njsd.c: CARD_DATA_RD -> REG_CARD_DATA_RD
[FIX] io_nmmc.c: CARD_CR1 --> REG_AUXPICNT
[FIX] io_nmmc.c: CARD_EEPDATA --> REG_AUXSPIDATA
[FIX] NeoSystem.c: diropen(), dirnext(), strcmpi(), dirclose() --> opendir(), readdir_r(), strcmp(), closedir()
[WAR] NeoVideoSprites.arm.c: some deprecated functions warnings
[WAR] libfat.c: _FAT_close_r, _FAT_write_r, _FAT_read_r, _FAT_seek_r, _FAT_fstat_r --> initialization from incompatible pointer type
[FIX] arm-none-eabi-gcc.exe: error unrecognized command line option '-mno-fpu' --> remove '-mno-fpu' from all Makefiles (could be this the explanation?)
[ERR] c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: address 0x23d4648 of arm9/NeoDS-master.arm9.elf section `.bss' is not within region `ewram'



Enough work for today... Any idea related to last error? :D
 
Last edited by xonn,

Indy13

Well-Known Member
Member
Joined
Jan 26, 2017
Messages
600
Trophies
0
Age
45
XP
1,270
Country
France
Oh ! Someone is still working on NeoDS that's a great news !

I know it's not really the subject of this thread but if you have some time to do it and especially the desire, combine NeoDS020 ez3in1 compatible with NeoDS021 will be a real update !

I left you few links :

NeoDS020 EZ flash 3in1 comp. : https://www.mediafire.com/file/mvlbdcpqj3rzwhq/NeoDs020.7z/file
NeoDS021 (allows to use more than 64 games) : https://gbatemp.net/attachments/neods021-zip.73354/

related threads :
https://gbatemp.net/threads/neods-a-guide-to-using-one-of-the-greatest-ds-emulators.291225/
https://gbatemp.net/threads/neods-update.374204/
 

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
NeoDS v0.2.1 was my first objetive, but @nitendo have not answered me yet the PM. He offered in that thread the source code files and libs necessary to compile.
If someone can send me those files, the update process would go faster for sure.

Edit: Permalink of nitendo's post where he talked about sending program&libs
 
Last edited by xonn,
  • Like
Reactions: Indy13

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
The update process is totally blocked. I have searched on Internet any info related to error section `.bss' is not within region `ewram' and I only know that I have inserted more than 4Mb of data in the EWRAM memory.
How could be it possible? Just few modifications can exceed 4Mb? How frustrating is this :cry:
 

edo9300

Well-Known Member
Member
Joined
Aug 19, 2018
Messages
102
Trophies
0
Age
24
XP
1,084
Country
Italy
So, i investigated a bit in this issue, and the ewram thing seems to be related in the size of ewram being changed during the years, it started as

then with time it got changed to

the emulator, tho, is still relying on it being 4M - 4K in size, in fact by manually changing the size to match that (that also is the one defined in the custom .ld file) the program compiles (but doesn't seem to start, probably because arbitrairly changing that value affects other memory) so it's a matter of 508K too much
 

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
So, if NeoDS last version was written in 2009 (or before) and now Devkitarm allows bigger ewram size... Why it's necessary to change it manually? I understand nothing
 

edo9300

Well-Known Member
Member
Joined
Aug 19, 2018
Messages
102
Trophies
0
Age
24
XP
1,084
Country
Italy
So, if NeoDS last version was written in 2009 (or before) and now Devkitarm allows bigger ewram size... Why it's necessary to change it manually? I understand nothing
now it allows less memory to be allocated, before it allowed 4MB-4KB (3996 KB), now it allows 4MB-512KB (3488 KB), so 508 KB less
 

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
now it allows less memory to be allocated, before it allowed 4MB-4KB (3996 KB), now it allows 4MB-512KB (3488 KB), so 508 KB less
So the only solution I can imagine is getting old versions of Devkitarm and libnds to modify neods. Or is there other choice?
 

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,564
Country
Chile
The update process is totally blocked. I have searched on Internet any info related to error section `.bss' is not within region `ewram' and I only know that I have inserted more than 4Mb of data in the EWRAM memory.
How could be it possible? Just few modifications can exceed 4Mb? How frustrating is this :cry:

First of all when building C/C++ binaries through GCC (a.k.a the compiler), it also has a linker step. The GCC compiler turns source code into ARM assembly. But then the GCC LD compiler, given a certain linker map file (think of a physical memory layout file the binary will be constructed around) builds the final NDS Binary.

In about 99% cases where this error happens, specifically around old NDS Homebrew trying to be ported to newer devkitARM, means the homebrew in question tries to manually allocate memory into the .bss section through inline assembly syntax (homebrew). Thus, when the GCC LD tries to allocate objects targeting the .bss section, the .bss section has no remaining space. (toolchain + homebrew)

You can either do:

1)
Remove all static references from the source code to .bss (such as static allocating buffers), and use malloc just once to allocate the same memory, and of course, the source code must be updated so all references to static buffers must be replaced by the pointer to the new memory allocated.

2)
Use an older environment that does not use that much .bss memory so the homebrew part will fit in the .bss section + the .bss section from the toolchain side (devkitARM).
 
Last edited by Coto,

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
Ok, I have managed to compile de d*mn code... Using devkitARM r34 + libnds 1.5.2 + libfat libs included in NeoDS code. Some changes in code have been reverted, because this version of devkitARM is a bit old (2010).
Now, the program freezes in a NDSL, and I suppose that the best way to locate the problem is using an emulator... but I need some advice with this: which one is better? which one allows user to debug code? And another problem added: DesMume and NO$GBA throws an error related to fatInit function (problems emulating FAT?)
 

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
I'm going to start over, I need to see this from another point of view.
I have downloaded devkitarm r30, libnds 1.4.3 and libfat 1.0.7. Those are the oldest libs I can are close to the original ones that was used to compile NeoDS V0.2.0
OK, now the problems detected are less and mostly related to register names, fixes done:

[FIX] NeoAudio.c: SOUND_CR --> REG_SOUNDCNT
[FIX] NeoVideoFixed.arm.c: BLEND_AB --> REG_BLDALPHA
[FIX] NeoVideoFixed.arm.c: BLEND_CR --> REG_BLDCNT
[FIX ?] template.c: TransferRegion undeclared --> line commented
[FIX] disc_io.c: can't --> cant (the aphostrophe was returning a warning)
[FIX] filetime.c: Implicit declaration of function localtime --> #include <time.c> (line added)
[WAR] libfat.c: _FAT_write_r, _FAT_read_r, _FAT_seek_r --> initialization from incompatible pointer type

The program compiles and a .nds file is created, but it doesn't work. I'm not happy with fourth fix, but I don't know how to correct it. The warning also worries me, because it could affect to the whole program.
Any thoughs?

Edit: the warning is generated because those methods has some argument with different types, but I think them are compatible: size_t and int, off_t and int
 
Last edited by xonn,
  • Like
Reactions: zfreeman

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
NeoDS compiled and working!
There are some things that must be fixed. For example, one or more layers of games are not shown, and touch screen is not responding, but I have implemented succesfully the swap feature and turned off backlight of upper screen (idk if it would save energy in a GB Macro...).
Yeah! :toot:
 

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
Anybody knows why touchRead() function doesn't work. It's always returning zero!

Edit: All buttons reads by arm7 are not updating when scanKeys() function is called. In this thread somebody talks about a some type of conflict when interrupts are used... and NeoDS uses them a lot!!!
This is harder than I thought at first... I will leave this hell until @nitendo reads my message and answers me. Working blindly with old code is like crashing into a wall... too hard for me :P
 
Last edited by xonn,

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
Some days after my last message, I'm happy to say "Mission complete!" :D
Emulator is compiled with some new lines of code that allow players to swap screens when L-button is pressed.
Now, NeoDS can be installed and enjoyed in a GBMacro console :yay:

I forgot to say, this version looks for roms in "/neogeo/" folder!

Github with binaries, code and libs here: https://github.com/xonn83/NeoDS
 
Last edited by xonn,

NightScript

Well-Known Member
Member
Joined
Feb 7, 2016
Messages
951
Trophies
1
Age
20
XP
2,232
Country
United States
I forgot to say, this version looks for roms in "/neogeo/" folder!
Why was this change made? Why not have a menu that can navigate the entire SD card including folders?

For example, most people have their set up as sd:/roms/platform/rom.platform

Alternatively, why not try to setup ARGV support
 

xonn

Well-Known Member
OP
Member
Joined
Jan 11, 2020
Messages
148
Trophies
0
Age
34
XP
893
Country
Spain
Why was this change made? Why not have a menu that can navigate the entire SD card including folders?

For example, most people have their set up as sd:/roms/platform/rom.platform

Alternatively, why not try to setup ARGV support
Because I couldn't get 0.2.1 source code, and I started to work from 0.2.0 that reads directly from / folder
When I have a little time, I may have an improvement in some other aspect
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    The Real Jdbye @ The Real Jdbye: both of which work well in potplayer