Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NDSi] Port Vanilla-Conquer to the Nintendo DSi #821

Open
wants to merge 2 commits into
base: vanilla
Choose a base branch
from

Conversation

giulianobelinassi
Copy link
Collaborator

This commit introduces a new target platform to Vanilla-Conquer:
The mighty Nintendo DSi.

It includes:
- A CMake toolchain file for devKitPro
- A video interface to the game graphical engine relying purely on libnds.
- A dedicated asynchronous sound engine running on the secondary ARM7.
- Fixing many unaligned accesses problems in the engine.
- Introduce ways of measuring how much RAM to allocate to BigShapeBuff.
- Optimized functions for the platform and a macro that can be used
by other developers to also change some functions optimizations
according to their needs.

DevKitARM and libnds and libfat is required to compile this port.

The word `Keyboard` conflicts with the typedef `Keyboard` in libnds.
So we have to rename it.
@giulianobelinassi giulianobelinassi force-pushed the ndsi_pr2 branch 6 times, most recently from b80f212 to eebd762 Compare July 24, 2022 23:24
Copy link
Contributor

@OmniBlade OmniBlade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a phenomenal amount of work put into this. I've only done a quick scan through and commented on a few things I've noticed so far. We probably also need to look at how we organise platform specific files as this PR adds a few port specific files in the form of arm assembly that maybe should be moved into their own sub directory.

add_definitions(-DARM7 -D_NDS)

set(ARCH "-mthumb -mthumb-interwork -mcpu=arm7tdmi -mtune=arm7tdmi")
set(CMAKE_C_FLAGS "${ARCH} -g -fomit-frame-pointer -fno-rtti -fno-exceptions -ffast-math -fstack-protector-all")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can avoid a lot of this redefintion of compiler flags by using target_compile_options instead to set different options on different targets.

set(CMAKE_CXX_FLAGS_RELEASE "-Os")
set(CMAKE_EXE_LINKER_FLAGS "-specs=ds_arm7.specs -mthumb -mthumb-interwork -Wl,-Map,vanilla.map")

set(ARM7_SRC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same goes for libraries by using target_link_libraries.

@@ -80,6 +90,10 @@ bool Find_File_Data_Posix::FindNextWithFilter()

bool Find_File_Data_Posix::FindFirst(const char* fname)
{
#ifdef _NDS
DS_Filesystem_Init();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be called on every attempt to find a file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initialization only happens once. But I think I can refactor this to initialize the filesystem on some constructor. That will guarantee that it is initialized before main is even called.

@@ -11,14 +11,14 @@

extern WWMouseClass* WWMouse;

#ifdef SDL2_BUILD
#if defined(SDL2_BUILD)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the style change?

@@ -240,10 +240,11 @@ AircraftClass::AircraftClass(AircraftType classid, HousesType house)
** Keep count of the number of units created. Dont track cargo planes as they are created
** automatically, not bought.
*/
#ifndef _NDS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should gate these behind NETWORKING since they are pointless in none networking builds.

@giulianobelinassi giulianobelinassi force-pushed the ndsi_pr2 branch 4 times, most recently from 8180027 to e6a34c7 Compare July 28, 2022 04:15
This commit introduces a new target platform to Vanilla-Conquer:
The mighty Nintendo DSi.

It includes:
  - A CMake toolchain file for devKitPro
  - A video interface to the game graphical engine relying purely on libnds.
  - A dedicated asynchronous sound engine running on the secondary ARM7.
  - Fixing many unaligned accesses problems in the engine.
  - Introduce ways of measuring how much RAM to allocate to BigShapeBuff.
  - Optimized functions for the platform and a macro that can be used
      by other developers to also change some functions optimizations
      according to their needs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants