Skip to content

Commit

Permalink
Update to v1.1
Browse files Browse the repository at this point in the history
- Allows modifying the frame rate and the number of players in the NES and SNES games.
- Allows you to modify the sound volume for some SNES base games.
- Add the option to individually modify the vertical and horizontal zoom of the N64 games.
- Allows you to move the game image area of the N64 games.
- Fixes an error that prevented editing the N64 Virtual Console settings without injecting a ROM.
- Some minor fixes.
  • Loading branch information
phacoxcll authored Mar 1, 2020
1 parent 356530c commit 07ae94c
Show file tree
Hide file tree
Showing 15 changed files with 1,933 additions and 641 deletions.
76 changes: 74 additions & 2 deletions PhacoxsInjector/HelpString.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 27 additions & 3 deletions PhacoxsInjector/HelpString.es.resx
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,10 @@
<data name="PackDescription" xml:space="preserve">
<value>Realiza la inyección y empaca el resultado en la ruta que selecciones. Para WUP Installer.</value>
</data>
<data name="Players" xml:space="preserve">
<data name="ShowPlayers" xml:space="preserve">
<value>Players</value>
</data>
<data name="PlayersDescription" xml:space="preserve">
<data name="ShowPlayersDescription" xml:space="preserve">
<value>Número de jugadores del juego que se aparecerá en las imágenes plantilla.</value>
</data>
<data name="ProductCode" xml:space="preserve">
Expand Down Expand Up @@ -442,6 +442,30 @@
<value>Zoom</value>
</data>
<data name="ZoomDescription" xml:space="preserve">
<value>Amplia o reduce el área de visualización del juego. Si la amplias mucho pude recortar la imagen del juego.</value>
<value>Amplia o reduce el área de visualización del juego. Si la amplias mucho puede salirse de la pantalla.</value>
</data>
<data name="Translation" xml:space="preserve">
<value>Translación</value>
</data>
<data name="TranslationDescription" xml:space="preserve">
<value>Desplaza el área de visualización del juego. Si la desplazas demasiado puede salirse de la pantalla.</value>
</data>
<data name="Speed" xml:space="preserve">
<value>Velocidad</value>
</data>
<data name="SpeedDescription" xml:space="preserve">
<value>Elige la velocidad de fotogramas que corresponda a la región del juego que quieres inyectar. 60 FPS para juegos NTSC (USA/JPN) o 50 FPS para juegos PAL (EUR).</value>
</data>
<data name="SoundVolume" xml:space="preserve">
<value>Volumen</value>
</data>
<data name="SoundVolumeDescription" xml:space="preserve">
<value>Modifica el volumen del audio del juego. Ningún juego oficial rebasa los 140. (Esta opción sólo está disponible en jugos base de Super Famicom o SNES Tipo B1 y Tipo B2).</value>
</data>
<data name="Players" xml:space="preserve">
<value>Jugadores</value>
</data>
<data name="PlayersDescription" xml:space="preserve">
<value>Indica el número máximo de jugadores que soporta el juego que quieres inyectar.</value>
</data>
</root>
30 changes: 27 additions & 3 deletions PhacoxsInjector/HelpString.resx
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,10 @@
<data name="Injecting" xml:space="preserve">
<value>Injecting</value>
</data>
<data name="Players" xml:space="preserve">
<data name="ShowPlayers" xml:space="preserve">
<value>Players</value>
</data>
<data name="PlayersDescription" xml:space="preserve">
<data name="ShowPlayersDescription" xml:space="preserve">
<value>Number of game players that will appear in the template images.</value>
</data>
<data name="ProductCode" xml:space="preserve">
Expand Down Expand Up @@ -363,7 +363,7 @@
<value>Zoom</value>
</data>
<data name="ZoomDescription" xml:space="preserve">
<value>Enlarge or reduce the viewing area of the game. If you expand it a lot I could crop the image of the game.</value>
<value>Enlarge or reduce the viewing area of the game. If you expand it a lot you can leave the screen.</value>
</data>
<data name="SNESBaseSelect" xml:space="preserve">
<value>Select the game folder of the Wii U SNES VC that you want to use as base.</value>
Expand Down Expand Up @@ -452,4 +452,28 @@
<data name="NDSIconBackgroundDescription" xml:space="preserve">
<value>Some icons do not look good with a black background; you can change it to the color you prefer.</value>
</data>
<data name="Translation" xml:space="preserve">
<value>Translation</value>
</data>
<data name="TranslationDescription" xml:space="preserve">
<value>Scroll the game display area. If you move it too much, you can leave the screen.</value>
</data>
<data name="Speed" xml:space="preserve">
<value>Speed</value>
</data>
<data name="SpeedDescription" xml:space="preserve">
<value>Choose the frame rate that corresponds to the region of the game you want to inject. 60 FPS for NTSC games (USA/JPN) or 50 FPS for PAL games (EUR).</value>
</data>
<data name="SoundVolume" xml:space="preserve">
<value>Sound volume</value>
</data>
<data name="SoundVolumeDescription" xml:space="preserve">
<value>Modify the volume of the game audio. Official games do not exceed 140. (This option is only available in Super Famicom or SNES base games Type B1 and Type B2).</value>
</data>
<data name="Players" xml:space="preserve">
<value>Players</value>
</data>
<data name="PlayersDescription" xml:space="preserve">
<value>Indicates the maximum number of players that supports the game you want to inject.</value>
</data>
</root>
81 changes: 59 additions & 22 deletions PhacoxsInjector/N64Injector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ public class N64Injector : WiiUInjector
{
public bool DarkFilter;
public bool Widescreen;
public float Scale;
public float ScaleX;
public float ScaleY;
public float TranslationX;
public float TranslationY;

public string ConfigFilePath
{ private set; get; }
Expand Down Expand Up @@ -47,7 +50,7 @@ public override string TitleId
int flags = Base.Index;
flags |= DarkFilter ? 0x80 : 0;
flags |= Widescreen ? 0x40 : 0;
flags |= Scale != 1.0F ? 0x20 : 0;
flags |= ScaleX != 1.0F ? 0x20 : (ScaleY != 1.0F ? 0x20 : (TranslationX != 0.0F ? 0x20 : (TranslationY != 0.0F ? 0x20 : 0)));

return "0005000064" + crc.ToString("X4") + ((byte)(flags)).ToString("X2");
}
Expand All @@ -67,7 +70,10 @@ public N64Injector()

DarkFilter = true;
Widescreen = false;
Scale = 1.0F;
ScaleX = 1.0F;
ScaleY = 1.0F;
TranslationX = 0.0F;
TranslationY = 0.0F;
}

public override void SetRom(string romPath)
Expand Down Expand Up @@ -120,7 +126,10 @@ private bool InjectGameLayout()
byte[] widescreenB = Widescreen ?
new byte[] { 0x44, 0xF0, 0, 0 } :
new byte[] { 0x44, 0xB4, 0, 0 };
byte[] scaleB = BitConverter.GetBytes(Scale);
byte[] scaleXB = BitConverter.GetBytes(ScaleX);
byte[] scaleYB = BitConverter.GetBytes(ScaleY);
byte[] translationXB = BitConverter.GetBytes(TranslationX);
byte[] translationYB = BitConverter.GetBytes(TranslationY);

byte[] magic = new byte[4];
uint offset = 0;
Expand Down Expand Up @@ -189,16 +198,26 @@ private bool InjectGameLayout()

if (name == "frame")
{
fs.Position = offset + 0x44;//Scale
fs.WriteByte(scaleB[3]);
fs.WriteByte(scaleB[2]);
fs.WriteByte(scaleB[1]);
fs.WriteByte(scaleB[0]);
fs.Position = offset + 0x48;//Scale
fs.WriteByte(scaleB[3]);
fs.WriteByte(scaleB[2]);
fs.WriteByte(scaleB[1]);
fs.WriteByte(scaleB[0]);
fs.Position = offset + 0x2C;//TranslationX
fs.WriteByte(translationXB[3]);
fs.WriteByte(translationXB[2]);
fs.WriteByte(translationXB[1]);
fs.WriteByte(translationXB[0]);
fs.Position = offset + 0x30;//TranslationX
fs.WriteByte(translationYB[3]);
fs.WriteByte(translationYB[2]);
fs.WriteByte(translationYB[1]);
fs.WriteByte(translationYB[0]);
fs.Position = offset + 0x44;//ScaleX
fs.WriteByte(scaleXB[3]);
fs.WriteByte(scaleXB[2]);
fs.WriteByte(scaleXB[1]);
fs.WriteByte(scaleXB[0]);
fs.Position = offset + 0x48;//ScaleY
fs.WriteByte(scaleYB[3]);
fs.WriteByte(scaleYB[2]);
fs.WriteByte(scaleYB[1]);
fs.WriteByte(scaleYB[0]);
fs.Position = offset + 0x4C;//Widescreen
fs.Write(widescreenB, 0, 4);
}
Expand Down Expand Up @@ -236,14 +255,32 @@ private bool InjectGameLayout()

private void InjectConfigFile()
{
if (Directory.Exists(BasePath + "\\content\\config"))
Directory.Delete(BasePath + "\\content\\config", true);
Directory.CreateDirectory(BasePath + "\\content\\config");

if (!ConfigFileIsValid)
File.Create(BasePath + "\\content\\config\\U" + Rom.ProductCodeVersion + ".z64.ini").Close();
else
VCN64ConfigFile.Copy(ConfigFilePath, BasePath + "\\content\\config\\U" + Rom.ProductCodeVersion + ".z64.ini");
if (RomIsValid)
{
if (Directory.Exists(BasePath + "\\content\\config"))
Directory.Delete(BasePath + "\\content\\config", true);
Directory.CreateDirectory(BasePath + "\\content\\config");

if (!ConfigFileIsValid)
File.Create(BasePath + "\\content\\config\\U" + Rom.ProductCodeVersion + ".z64.ini").Close();
else
VCN64ConfigFile.Copy(ConfigFilePath, BasePath + "\\content\\config\\U" + Rom.ProductCodeVersion + ".z64.ini");
}
else if (ConfigFileIsValid)
{
string[] files = Directory.GetFiles(BasePath + "\\content\\rom");

if (files.Length > 1)
throw new Exception("The folder \"" + BasePath + "\\content\\rom\" contains more than one file.");

string filename = Path.GetFileName(files[0]);

if (Directory.Exists(BasePath + "\\content\\config"))
Directory.Delete(BasePath + "\\content\\config", true);
Directory.CreateDirectory(BasePath + "\\content\\config");

VCN64ConfigFile.Copy(ConfigFilePath, BasePath + "\\content\\config\\" + filename + ".ini");
}
}

protected override void InjectRom()
Expand Down
14 changes: 9 additions & 5 deletions PhacoxsInjector/NESInjector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public enum AspectRatio
};

public AspectRatio AspectRatioValue;
public byte Speed;
public byte Players;

public override string TitleId
{
Expand Down Expand Up @@ -67,20 +69,22 @@ public override void Inject(bool encrypt, string outputPath, string shortName, s

protected override void InjectRom()
{
byte speed = (byte)(Speed == 50 ? 50 : 60);
byte players = (byte)(Players == 4 ? 4 : Players == 3 ? 3 : 2);
short widthTv;
short widthDrc;
switch (AspectRatioValue)
{
case AspectRatio.H8V7:
widthTv = 2348;
widthDrc = 1045;
widthTv = 2347;
widthDrc = 1044;
break;
case AspectRatio.H4V3:
widthTv = 2012;
widthDrc = 896;
widthDrc = 895;
break;
case AspectRatio.H16V9:
widthTv = 1510;
widthTv = 1509;
widthDrc = 671;
break;
default:
Expand All @@ -94,7 +98,7 @@ protected override void InjectRom()

DirectoryInfo code = new DirectoryInfo(BasePath + "\\code");
FileInfo[] rpxFiles = code.GetFiles("*.rpx");
RPXNES.Inject(rpxFiles[0].FullName, RomPath, Environment.CurrentDirectory + "\\resources\\nes.rpx", widthTv, widthDrc);
RPXNES.Inject(rpxFiles[0].FullName, RomPath, Environment.CurrentDirectory + "\\resources\\nes.rpx", speed, players, 0, 0, widthTv, widthDrc);

File.Delete(rpxFiles[0].FullName);
File.Move(Environment.CurrentDirectory + "\\resources\\nes.rpx", rpxFiles[0].FullName);
Expand Down
Loading

0 comments on commit 07ae94c

Please sign in to comment.