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

Nintendo Switch #181

Merged
merged 8 commits into from Nov 24, 2019
Merged

Nintendo Switch #181

merged 8 commits into from Nov 24, 2019

Conversation

AJenbo
Copy link
Member

@AJenbo AJenbo commented Jul 15, 2019

This is an effort to upstream the Switch port created by @lantus (MVG) in a manner that maintains other ports and full credit via git commits. To do so some commits have been edited, mainly when the change is both temporary and destructive or could cause conflicts.

This will hopefully help to resolve lantus/devilution-nx#7

MVG's video about the project:
https://www.youtube.com/watch?v=5tADL_fmsHQ&t=34s

This PR is currently in draft mode while we work out some outstanding issues regarding the merge:

  • Unify code where there doesn't need to be a difference between Switch and other ports
  • Make a separate #ifdef for controller code and switch code so it can be enabled independently
  • Create a readme with Switch relevant info in the switch folder
  • Cherry pick all commits from https://github.com/lantus/devilution-nx without breaking other platforms
  • Reduce changes in the Source/ folder to a minimum
  • See if manipulating MouseX/MouseY directly is needed if SetCursorPos is re-enabled
  • Remove libsodium dependency for Switch
  • Expose DSBSTATUS_PLAYING in a way that is picked up by the Switch build process
  • Fix macOS builds
  • Merge with the latest code from master
  • Fix escaping videoes via keyboard input
  • Fix SDL1 builds

New features compared to devilution-nx:

  • All builds are now automatically compiled for the switch via CircleCI
  • Map all keyboard keys
  • Fix save game compatibility
  • Add missing shadow in the credits
  • Fix zooming in the minimap for some keyboards
  • Fix typos
  • Fix TCP code
  • Correct directional sounds
  • Fix multiplayer bug
  • All code now matches the original Diablo (fixing a few in game bugs)
  • Tons of code clean up and better code documentation
  • Fix clang-format configuration
  • Correct file encoding
  • Fix crash in town with some compilers
  • Correct crash when exiting menu
  • Error messages implemented in GUI
  • Much lower CPU usage
  • FPS no longer locked to 20
  • Many bug fixes in the controller implementation
  • More responsive controller
  • highlight both primary and secondary target

@AJenbo AJenbo changed the title Switch Nintendo Switch Jul 15, 2019
@AJenbo AJenbo mentioned this pull request Jul 15, 2019
@AJenbo AJenbo force-pushed the switch branch 4 times, most recently from 4d84334 to 9b63d28 Compare July 15, 2019 20:00
@AJenbo AJenbo mentioned this pull request Jul 15, 2019
SourceX/miniwin/misc_msg.cpp Outdated Show resolved Hide resolved
SourceX/storm/storm.cpp Outdated Show resolved Hide resolved
switch/mman.h Outdated Show resolved Hide resolved
SourceX/miniwin/misc.cpp Outdated Show resolved Hide resolved
SourceX/miniwin/misc.cpp Outdated Show resolved Hide resolved
SourceX/miniwin/misc.cpp Outdated Show resolved Hide resolved
@mewmew
Copy link
Contributor

mewmew commented Jul 16, 2019

Now we just have to get a Switch console for our CI cluster :p

Source/init.cpp Outdated Show resolved Hide resolved
switch/readme-switch.md Outdated Show resolved Hide resolved
@AJenbo
Copy link
Member Author

AJenbo commented Sep 26, 2019

I have taken care of most of the platform code. If anyone could test that it still loads correctly on there switch that would be a huge help:
https://1663-143324737-gh.circle-artifacts.com/0/diablo-nx.nro

@mewmew
Copy link
Contributor

mewmew commented Sep 26, 2019

@AJenbo, do you need to do something specific to make it possible to run custom ROMs on the Switch?

@ghost
Copy link

ghost commented Sep 26, 2019

to make it possible to run custom ROMs on the Switch?

As someone who originated from the console scene, I can say very much you aren't going to be running any custom code on a modern console without some sort of userland exploit. The Switch came with a design flaw that allowed them to be hacked to run unsigned code but Nintendo revised the motherboard so newer models cannot.

Modern consoles have sigchecks on code and certain keys are used to sign it based on desired user level access, with kernel keys being reserved for firmware devs and userland for game devs.

@AJenbo
Copy link
Member Author

AJenbo commented Sep 30, 2019

This port is now in fairly good shape, the only parts that are missing relates to cleaning up the controller code.

It would also be great to get it compiling using CMake rather than a custom make script @lantus is this something you have experience with?

@AJenbo AJenbo added the help wanted Extra attention is needed label Oct 6, 2019
@AJenbo
Copy link
Member Author

AJenbo commented Nov 11, 2019

Controller code has now been cleaned up and the build process moved to CMake, both thanks to @glebm.
This also brings several improvements to the controleller code in terms of responsiveness and issue and bugs being fixed (no more talking to ghosts in the dungion).

All that remains is basically to see if SetCursorPos can be reenabled and a handful of other minor cleanups outlined in #443

@ghost
Copy link

ghost commented Nov 11, 2019

All that remains is basically to see if SetCursorPos can be reenabled

Honestly I don't mind that one being disabled. Having the cursor move around when i show the inventory or spell list is quite annoying.

@AJenbo
Copy link
Member Author

AJenbo commented Nov 11, 2019

@galaxyhaxz well it is also needed for keeping the mouse in sync with the emulated mouses (touch and game controller), so would just be nice to have it work the same on all devices. @rsn8887 isn't it possible to attach mouse an keyboard to the Switch and play the game with that?

@rsn8887
Copy link
Contributor

rsn8887 commented Nov 11, 2019

Yes that is possible and works, or at least used to work always, so... hmm... I guess all the SDL mouse stuff should work on Switch after all. The touch code already works by pushing SDL events into the event queue. I think only the analog joystick mouse was still using an emulated mouse. However the analog joystick mouse could/should probably also be implemented in such a way that it pushes SDL mousemotion events every frame, instead of the hack it currently is?!

@glebm
Copy link
Collaborator

glebm commented Nov 12, 2019

@rsn8887 SetCursorPos calls SDL_WarpMouseInWindow which generates a mouse motion event:

SetCursorPos(x, y);

Packaging/switch/build.sh Outdated Show resolved Hide resolved
@AJenbo AJenbo force-pushed the switch branch 3 times, most recently from c48ef4c to 4250aa1 Compare November 23, 2019 19:08
@AJenbo AJenbo marked this pull request as ready for review November 24, 2019 04:31
@AJenbo AJenbo force-pushed the switch branch 2 times, most recently from 8e1e0ad to d1fbb5f Compare November 24, 2019 14:03
glebm and others added 5 commits November 24, 2019 15:08
* Switch port: Code changes for latest devkitpro
* switch/build.sh: Fewer devkitpro packages
Including artifacts for any one that wants to test nightly
@AJenbo AJenbo force-pushed the switch branch 2 times, most recently from 846ecf3 to 71fdec0 Compare November 24, 2019 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No commit history from upstream
4 participants