Skip to content

Commit

Permalink
FEAT: Add Pokémon Trading/Colosseum support (#1007)
Browse files Browse the repository at this point in the history
## Overview 
This is a Hotspot/GLO function and does not currently support trading
globally - it will work with friends nearby over the hotspot connection
- I will work on Global another time

The first connection after a reboot may fail. (Looking into this) 

Includes a recent compile of hostapd_cli and a change to hostapd.conf to
add a ctrl_interface for hostapd to hook.

Adds Pokémon Trading/Battling over link for:
- `Red` <-> `Blue` <-> `Yellow`
- `Gold` <-> `Silver` <-> `Crystal`
(But not from `Gold` -> `Red` for example)

I've tested this on:
- `Red` -> `Blue`
- `Blue` -> `Yellow`
- `Red` -> `Yellow`
- `Crystal` -> `Crystal`

There may be a delay for the host when leaving RetroArch - unsure of the
cause and also present in Easy Netplay

## For the host:
You must use GLO and press Y on the game you want to host (EG loading
Pokémon Red will load the Pokémon Red save)

## For the client
You must use GLO and press Y on the game you want 

## Notes
It does NOT matter which core is set to default in GLO - this process
hardcodes TGB Dual for the trade. However! When you load into RA to play
on your own you must take the saved location into consideration. They
will be in the TGB Dual folder.
This means when you start the game through normal means and your core
isn't set to TGB Dual you will not load these saves unless you move them
(or just load TGB Dual).

You **MUST** have saves that match the identical name of the Rom

> If your rom is called: Pokémon - Red Version (USA, Europe) (SGB
Enhanced).zip
> Your save must be called: Pokémon - Red Version (USA, Europe) (SGB
Enhanced).srm

The save files must be located in:
`/mnt/SDCARD/Saves/CurrentProfile/saves/TGB Dual`

You **MUST** exit the trade room in Pokémon by going to Menu -> Reset
(On Gold/silver/crystal just leave the room)
You **MUST** then save the game by going to Menu -> Save when you load
back in
You **MUST** Exit RetroArch gracefully after (Menu -> Quit)
You **MUST** NOT interrupt the process after RetroArch exits.

You may have changed the settings in TGB Dual so you have 2 screens
showing or you may not, the script should handle this so only 1 is
showing (yours)

Logging available by touching .tmp_update/config/.logging and will be
generated in ./tmp_update/logs

## **Test process** 
## Preparation
- [ ] Perform fresh install (OR manually copy the files from the PR) - A
format generally isn't required
- [ ] If you don't format/fresh install, make sure your retroarch.cfg is
the default one installed by Onion (I haven't tested on other devices)
- [ ] Enable & connect WIFI
- [ ] Add the save files/roms to the relevant locations 
- [ ] Open your `/mnt/SDCARD/Saves/CurrentProfile/config/TGB Dual/TGB
Dual.opt` file and take note of the contents (The script makes changes
but reverts them afterwards)
- [ ] EITHER Connect with wifi already enabled or Disable WIFI (script
will bring it up)

You'll currently have 20 seconds after starting the host to start the
client. We can discuss this timeout.

## Session Setup
- [ ] On the host: Head to the rom you wish to play, for example: Go to
Games, GBC, Pokémon Crystal and press Y to open GLO (Also in
Recents/favs etc)
- [ ] On the host: Select "Pokémon Trade/Battle: Host Hotspot" - It will
now wait for a client
- [ ] On the client: Head to the rom you wish to play, for example: Go
to Games, GBC, Pokémon Crystal and press Y to open GLO
- [ ] On the host: Select "Pokémon Trade/Battle: Join Hotspot"
- [ ] Wait for the process to complete
- [ ] Select Join on the splash screens - You **MUST** join on the host
first for the Netplay session to go live

## The trade
- [ ] Go to the Pokémon center and head to the trade link person
- [ ] Go through the dialogue until she allows you into the room
- [ ] Trade your Pokémon
- [ ] If on Red/Blue/Yellow Go to menu Reset and load back in
- [ ] If on Gold/Silver/Crystal Go out of the door 
- [ ] Press start to open the menu
- [ ] Save your game on both devices
- [ ] Important: Retroarch must exit gracefully without the script dying
with it. - Press Menu + Select and then B, then Exit.
- [ ] Important: Do not interrupt this process, you should see the
host/client talk to each other and sync the changes
- [ ] Go back to GLO on the game you selected and set the default core
to TGB Dual
- [ ] Start the game in single player mode (Just click it from
recents/fav etc) and it should load your save.
- [ ] Observe in both games you have now traded Pokemon.

## Cleanup
- [ ] Observe WIFI on both clients reassociates with the original
network (if any)
- [ ] Observe you have a backup of your original save before the trade
took place in the `/mnt/SDCARD/Saves/CurrentProfile/saves/TGB Dual`
folder
- [ ] Make sure your `/mnt/SDCARD/Saves/CurrentProfile/config/TGB
Dual/TGB Dual.opt` file contents have reverted (Stayed the same as they
were at the start)

Retry the process after a fresh restart with WIFI enabled in the
preparation stage (Rather than disabling it)

All files generated by the script are intended to be cleaned apart from
save backups, check save folders/rom folders for duplicates.

---------

Co-authored-by: Aemiii91 <44569252+Aemiii91@users.noreply.github.com>
  • Loading branch information
XK9274 and Aemiii91 authored Jul 18, 2023
1 parent 4e8edfc commit a75d37a
Show file tree
Hide file tree
Showing 7 changed files with 1,285 additions and 0 deletions.
Binary file added static/build/.tmp_update/bin/hostapd_cli
Binary file not shown.
Loading

1 comment on commit a75d37a

@Kordman916
Copy link

Choose a reason for hiding this comment

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

This is incredible - Great work guys.

Please sign in to comment.