Skip to content

Commit

Permalink
Add TG16/PCE-CD compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
CatmanFan committed Jan 20, 2025
1 parent 52bbf58 commit 42c46dc
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 71 deletions.
14 changes: 7 additions & 7 deletions FriishProduce/MainForm.Designer.cs

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

2 changes: 2 additions & 0 deletions FriishProduce/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public partial class MainForm : Form
{ Platform.SMS, new Icon(Properties.Resources.sega_master_system, 16, 16).ToBitmap() },
{ Platform.SMD, new Icon(Properties.Resources.sega_genesis, 16, 16).ToBitmap() },
{ Platform.PCE, new Icon(Properties.Resources.nec_turbografx_16, 16, 16).ToBitmap() },
{ Platform.PCECD, new Icon(Properties.Resources.nec_turbografx_16, 16, 16).ToBitmap() },
{ Platform.NEO, new Icon(Properties.Resources.snk_neo_geo_aes, 16, 16).ToBitmap() },
#if DEBUG
{ Platform.C64, Properties.Resources.c64 },
Expand All @@ -44,6 +45,7 @@ public partial class MainForm : Form
Platform.SMD.ToString(),
null,
Platform.PCE.ToString(),
Platform.PCECD.ToString(),
null,
Platform.NEO.ToString(),
null,
Expand Down
12 changes: 6 additions & 6 deletions FriishProduce/MainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2931,6 +2931,12 @@
<data name="&gt;&gt;open_project.Type" xml:space="preserve">
<value>System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;open_recent.Name" xml:space="preserve">
<value>open_recent</value>
</data>
<data name="&gt;&gt;open_recent.Type" xml:space="preserve">
<value>System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;save_project.Name" xml:space="preserve">
<value>save_project</value>
</data>
Expand Down Expand Up @@ -3117,12 +3123,6 @@
<data name="&gt;&gt;Tip.Type" xml:space="preserve">
<value>TheArtOfDev.HtmlRenderer.WinForms.HtmlToolTip, HtmlRenderer.WinForms, Version=1.5.1.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;open_recent.Name" xml:space="preserve">
<value>open_recent</value>
</data>
<data name="&gt;&gt;open_recent.Type" xml:space="preserve">
<value>System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>MainForm</value>
</data>
Expand Down
10 changes: 6 additions & 4 deletions FriishProduce/ProjectForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ public void RefreshForm()
break;

case Platform.PCE:
case Platform.PCECD:
case Platform.NEO:
case Platform.MSX:
case Platform.C64:
Expand Down Expand Up @@ -701,7 +702,6 @@ private void Setup()
case Platform.C64:
TIDCode = "C";
rom = new ROM_C64();
showPatch = false;
break;

case Platform.MSX:
Expand Down Expand Up @@ -1541,10 +1541,10 @@ public void LoadROM(string ROMpath, bool AutoScan = true, bool filter = false)
{
if (Path.GetExtension(path).ToLower() == ".cue")
foreach (var item in Directory.EnumerateFiles(Path.GetDirectoryName(path)))
if (Path.GetExtension(item).ToLower() == ".bin" && Path.GetFileNameWithoutExtension(path).ToLower() == Path.GetFileNameWithoutExtension(item).ToLower())
if (Path.GetExtension(item).ToLower() == ".bin" || Path.GetExtension(item).ToLower() == ".iso" && Path.GetFileNameWithoutExtension(path).ToLower() == Path.GetFileNameWithoutExtension(item).ToLower())
path = item;

if (Path.GetExtension(path).ToLower() != ".bin")
if (Path.GetExtension(path).ToLower() != ".bin" && Path.GetExtension(path).ToLower() != ".iso")
return (null, null, null, null, null, false);
}

Expand Down Expand Up @@ -1672,6 +1672,7 @@ private void saveToWAD(object sender, System.ComponentModel.DoWorkEventArgs e)
device = forwarder_root_device.SelectedIndex == 1 ? Forwarder.Storages.USB : Forwarder.Storages.SD;
}));

Start:
// Get WAD data
// *******
if (inWadFile != null) m.GetWAD(inWadFile, baseID.Text);
Expand All @@ -1696,7 +1697,8 @@ private void saveToWAD(object sender, System.ComponentModel.DoWorkEventArgs e)
case Platform.C64:
case Platform.MSX:
if (isVirtualConsole)
m.Inject();
try { m.Inject(); }
catch (Exception ex) { if (ex.Message == "U8 Header: Invalid Magic!") goto Start; else throw; }
else
m.CreateForwarder(emulator, device);
break;
Expand Down
Binary file removed FriishProduce/Resources/apps/bincuesplit.exe
Binary file not shown.
Binary file removed FriishProduce/Resources/apps/tg16inject.exe
Binary file not shown.
111 changes: 72 additions & 39 deletions FriishProduce/_classes/Creators/WiiVC/PCE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private int ConfigIndex

private string Config
{
get => Encoding.Default.GetString(MainContent.Data[ConfigIndex]);
get => Encoding.ASCII.GetString(MainContent.Data[ConfigIndex]);
}

/// <summary>
Expand Down Expand Up @@ -67,17 +67,50 @@ protected override void ReplaceROM()
}
}

/* Utils.Run
Utils.Run
(
FileDatas.Apps.bincuesplit,
"bincuesplit.exe",
"CDROM.cue hcd"
); */
"pcecd\\bincuesplit.exe",
Paths.WorkingFolder,
$"\"{Path.GetFileName(ROM.FilePath)}\" hcd"
);

string hcd_folder = null;

foreach (var item in Directory.EnumerateFiles(Paths.WorkingFolder, "*.*", SearchOption.AllDirectories))
if (Path.GetExtension(item).ToLower() == ".hcd")
{
File.WriteAllText(item, File.ReadAllText(item).Replace(".iso", ".bin"));
hcd_folder = Path.GetDirectoryName(item) + '\\';
}

foreach (var item in Directory.EnumerateFiles(hcd_folder, "*.iso"))
{
Utils.Run
(
"pcecd\\tg16inject.exe",
hcd_folder,
$"\"{Path.GetFileName(item)}\" \"{Path.GetFileNameWithoutExtension(item)}.bin\""
);

try { File.Delete(item); } catch { }
}

foreach (var item in MainContent.StringTable)
if (item.ToLower().EndsWith(".bin") || item.ToLower().EndsWith(".ogg"))
MainContent.RemoveFile(item);

foreach (var item in Directory.EnumerateFiles(hcd_folder, "*.*"))
{
if (Path.GetExtension(item).ToLower() == ".hcd")
MainContent.ReplaceFile(MainContent.GetNodeIndex(rom), File.ReadAllBytes(item));
else
MainContent.AddFile(Path.GetFileName(item), File.ReadAllBytes(item));
}
}

// LZ77-compressed
// ****************
if (rom.ToLower().Contains("lz77"))
else if (rom.ToLower().Contains("lz77"))
{
File.WriteAllBytes(Paths.WorkingFolder + "rom_comp", MainContent.Data[MainContent.GetNodeIndex(rom)]);
File.WriteAllBytes(Paths.WorkingFolder + "rom", ROM.Bytes);
Expand Down Expand Up @@ -231,35 +264,35 @@ protected override void ModifyEmulatorSettings()
PAD5=1
NOFPA=1 */

// -----------------------------------------------------
// CONFIG from Castlevania Rondo of Blood:
// -----------------------------------------------------
/* NAME=KMCD3005
ROM=KMCD3005.hcd
BACKUPRAM=1
MULTITAP=1
HDS=0
RASTER=0
SPRLINE=0
NOFPA=1
IRQMODE=0
EUROPE=1
HIDEOVERSCAN=1
YOFFSET=8 */

// -----------------------------------------------------
// CONFIG from Street Fighter 'II: Champion Edition:
// -----------------------------------------------------
/* NAME=HE93002
ROM=/LZ77HE93002.BIN
BACKUPRAM=0
MULTITAP=1
HDS=0
RASTER=0
POPULUS=0
SPRLINE=0
PAD5=0
NOFPA=1
PADBUTTON=6 */
}
}
// -----------------------------------------------------
// CONFIG from Castlevania Rondo of Blood:
// -----------------------------------------------------
/* NAME=KMCD3005
ROM=KMCD3005.hcd
BACKUPRAM=1
MULTITAP=1
HDS=0
RASTER=0
SPRLINE=0
NOFPA=1
IRQMODE=0
EUROPE=1
HIDEOVERSCAN=1
YOFFSET=8 */

// -----------------------------------------------------
// CONFIG from Street Fighter 'II: Champion Edition:
// -----------------------------------------------------
/* NAME=HE93002
ROM=/LZ77HE93002.BIN
BACKUPRAM=0
MULTITAP=1
HDS=0
RASTER=0
POPULUS=0
SPRLINE=0
PAD5=0
NOFPA=1
PADBUTTON=6 */
}
}
3 changes: 2 additions & 1 deletion FriishProduce/_classes/Creators/WiiVC/_base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ protected virtual void Load()
if (needsManualLoaded && (mainContentIndex <= 1)) mainContentIndex = 5;

if (mainContentIndex > 1 && WAD.Contents.Length > mainContentIndex)
MainContent = U8.Load(WAD.Contents[mainContentIndex]);
try { MainContent = U8.Load(WAD.Contents[mainContentIndex]); }
catch { }

manualContentIndex = 5;
ManualContent = mainContentIndex == manualContentIndex ? null : U8.Load(WAD.Contents[manualContentIndex]);
Expand Down
2 changes: 1 addition & 1 deletion FriishProduce/_classes/Databases/LibRetro.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public static (string Name, string Serial, string Year, string Players, string I
(string name, string serial, string year, string players, string image) result = (rows[0][1]?.ToString(), rows[0][2]?.ToString(), rows[0][3]?.ToString(), rows[0][4]?.ToString(), rows[0][5]?.ToString());

bool complete = !string.IsNullOrEmpty(result.name) && !string.IsNullOrEmpty(result.players) && !string.IsNullOrEmpty(result.year) && !string.IsNullOrEmpty(result.image);
if (platform == Platform.C64) complete = !string.IsNullOrEmpty(result.name) && !string.IsNullOrEmpty(result.image);
if (platform == Platform.C64 || platform == Platform.PCECD) complete = !string.IsNullOrEmpty(result.name) && !string.IsNullOrEmpty(result.image);

return (result.name, result.serial, result.year, result.players, result.image, complete);
}
Expand Down
18 changes: 9 additions & 9 deletions FriishProduce/bin/Release/resources/tools/frodosrc/Frodo.fpr
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,36 @@ LatencyAvg = 280
ScalingNumerator = 2
ScalingDenominator = 2
DriveType8 = D64
DrivePath8 =
DrivePath8 = rom.d64
DriveType9 = DIR
DrivePath9 =
DriveType10 = DIR
DrivePath10 =
DriveType11 = DIR
DrivePath11 =
ViewPort = Default
ViewPort = 384x272
DisplayMode = Default
SIDType = DIGITAL
REUSize = NONE
DisplayType = WINDOW
SpritesOn = TRUE
SpriteCollisions = TRUE
Joystick1On = TRUE
Joystick2On = TRUE
Joystick1On = FALSE
Joystick2On = FALSE
JoystickSwap = FALSE
LimitSpeed = TRUE
FastReset = FALSE
FastReset = TRUE
CIAIRQHack = FALSE
MapSlash = TRUE
MapSlash = FALSE
Emul1541Proc = FALSE
SIDFilters = TRUE
SIDFilters = FALSE
DoubleScan = TRUE
HideCursor = TRUE
DirectSound = TRUE
ExclusiveSound = FALSE
AutoPause = FALSE
PrefsAtStartup = FALSE
SystemMemory = FALSE
SystemMemory = TRUE
AlwaysCopy = FALSE
SystemKeys = TRUE
SystemKeys = FALSE
ShowLEDs = TRUE
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ This injector bypasses other third-party assets (such as Common-Key.bin, HowardC
* Nintendo 64
* SEGA Master System
* SEGA Mega Drive / Genesis
* NEC TurboGrafx-16 / PC Engine (HuCARD)
* NEC TurboGrafx-16 / PC Engine (HuCARD & CD-ROM)
* SNK NEO-GEO
* Commodore 64
* Microsoft MSX / MSX2
Expand All @@ -48,9 +48,6 @@ Please check the **[wiki](https://catmanfan.github.io/FriishProduce/)** for a tu
### Potential
- [ ] Merge separate components of ProjectForm into panels / Create UserControl for content options ?

### Future platforms
* TurboGrafx-16 CD (needs several programs to convert ISO to injectable format)

---

### License
Expand Down

0 comments on commit 42c46dc

Please sign in to comment.