-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from shuichitakano/feature/scale8_7
8:7スケール対応
- Loading branch information
Showing
7 changed files
with
519 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,41 @@ | ||
# pico-infones | ||
|
||
This software is a port of InfoNES, a NES emulator, for the Raspberry Pi Pico, and supports video and audio output over HDMI. | ||
The code for HDMI output is based on [PicoDVI](https://github.com/Wren6991/PicoDVI). | ||
|
||
## How to use. | ||
The ROM should be placed in some way from 0x10080000, and can be easily transferred using picotool. | ||
## Wiring | ||
The default pinout of the HDMI connector follows the [Pico-DVI-Sock](https://github.com/Wren6991/Pico-DVI-Sock). | ||
|
||
The controller should be connected to the micro USB port of the Raspberry Pi Pico via an OTG adapter. | ||
|
||
Supply +5V to VBUS (pin 40) as power source. Be careful not to connect the power supply at the same time as the PC connection, for example when writing programs or ROMs. | ||
|
||
## ROM | ||
The ROM should be placed in some way from 0x10080000, and can be easily transferred using [picotool](https://github.com/raspberrypi/picotool). | ||
``` | ||
picotool load foo.nes -t bin -o 0x10080000 | ||
``` | ||
|
||
You can either place the .nes files directly or place a tar file containing multiple .nes files. The maximum file size that can be used is 1.5 MiB for the standard Raspberry Pi Pico. | ||
|
||
## Wiring | ||
The code for HDMI output is based on [PicoDVI](https://github.com/Wren6991/PicoDVI), please refer to the circuit of the HDMI part of PicoDVI for wiring. | ||
## Controller | ||
The following controllers are supported. | ||
|
||
- BUFFALO BGC-FC801 | ||
- SONY DUALSHOCK 4 | ||
- SONY DualSense | ||
|
||
There are several special functions assigned to button combinations. | ||
|
||
| Buttton | Function | | ||
| -- | -- | | ||
| SELECT + START | Reset the emulator | | ||
| SELECT + LEFT / RIGHT | Select the next ROM | | ||
| SELECT + UP / DOWN | Switch the screen mode | | ||
| SELECT + A / B | Toggle rapid-fire | | ||
|
||
## Battery backed SRAM | ||
If there is a game with battery-backed memory, 8K bytes per title will be allocated from address 0x10080000 in the reverse direction. | ||
Writing to Flash ROM is done at the timing when reset or ROM selection is made. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* author : Shuichi TAKANO | ||
* since : Sun Jan 02 2022 18:19:28 | ||
*/ | ||
|
||
#include "gamepad.h" | ||
|
||
#include <stdio.h> | ||
|
||
namespace io | ||
{ | ||
namespace | ||
{ | ||
GamePadState currentGamePad_[2]; | ||
} | ||
|
||
GamePadState &getCurrentGamePadState(int i) | ||
{ | ||
return currentGamePad_[i]; | ||
} | ||
|
||
void | ||
GamePadState::convertButtonsFromAxis(int axisX, int axisY) | ||
{ | ||
int x = axis[axisX]; | ||
int y = axis[axisY]; | ||
|
||
if (x < 64) | ||
{ | ||
buttons |= Button::LEFT; | ||
} | ||
else if (x > 192) | ||
{ | ||
buttons |= Button::RIGHT; | ||
} | ||
|
||
if (y < 64) | ||
{ | ||
buttons |= Button::UP; | ||
} | ||
else if (y > 192) | ||
{ | ||
buttons |= Button::DOWN; | ||
} | ||
} | ||
|
||
void | ||
GamePadState::convertButtonsFromHat() | ||
{ | ||
static constexpr int table[] = { | ||
Button::UP, | ||
Button::UP | Button::RIGHT, | ||
Button::RIGHT, | ||
Button::DOWN | Button::RIGHT, | ||
Button::DOWN, | ||
Button::LEFT | Button::DOWN, | ||
Button::LEFT, | ||
Button::LEFT | Button::UP, | ||
}; | ||
auto i = static_cast<int>(hat); | ||
if (i < 8) | ||
{ | ||
buttons |= table[i]; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.