Skip to content

Commit

Permalink
$fully_updated
Browse files Browse the repository at this point in the history
  • Loading branch information
xharen committed Dec 7, 2023
1 parent e428524 commit ceb9db6
Show file tree
Hide file tree
Showing 18 changed files with 1,555 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "OPL Game Installer/libcurl"]
path = OPL Game Installer/libcurl
url = https://github.com/curl/curl
[submodule "OPL Game Installer/lib9660"]
path = OPL Game Installer/lib9660
url = https://github.com/erincandescent/lib9660
31 changes: 31 additions & 0 deletions OPL Game Installer.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33815.320
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OPL Game Installer", "OPL Game Installer\OPL Game Installer.vcxproj", "{1157B2FE-476C-425F-98BB-4712E3D3E0AC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1157B2FE-476C-425F-98BB-4712E3D3E0AC}.Debug|x64.ActiveCfg = Debug|x64
{1157B2FE-476C-425F-98BB-4712E3D3E0AC}.Debug|x64.Build.0 = Debug|x64
{1157B2FE-476C-425F-98BB-4712E3D3E0AC}.Debug|x86.ActiveCfg = Debug|Win32
{1157B2FE-476C-425F-98BB-4712E3D3E0AC}.Debug|x86.Build.0 = Debug|Win32
{1157B2FE-476C-425F-98BB-4712E3D3E0AC}.Release|x64.ActiveCfg = Release|x64
{1157B2FE-476C-425F-98BB-4712E3D3E0AC}.Release|x64.Build.0 = Release|x64
{1157B2FE-476C-425F-98BB-4712E3D3E0AC}.Release|x86.ActiveCfg = Release|Win32
{1157B2FE-476C-425F-98BB-4712E3D3E0AC}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7A169FAA-3D76-46AE-A474-9946DBB52021}
EndGlobalSection
EndGlobal
Binary file added OPL Game Installer/OPL Game Installer.aps
Binary file not shown.
Binary file added OPL Game Installer/OPL Game Installer.rc
Binary file not shown.
166 changes: 166 additions & 0 deletions OPL Game Installer/OPL Game Installer.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="lib9660\lib9660.c" />
<ClCompile Include="main.cpp" />
<ClCompile Include="isoparser.cpp" />
<ClCompile Include="opl.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="isoparser.h" />
<ClInclude Include="lib9660\lib9660.h" />
<ClInclude Include="opl.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="utilities.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="OPL Game Installer.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="..\..\..\..\..\Downloads\PlayStation_logo.ico" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{1157b2fe-476c-425f-98bb-4712e3d3e0ac}</ProjectGuid>
<RootNamespace>FAT32Writer</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LibraryPath>libcurl/debug64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LibraryPath>libcurl/release64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LibraryPath>libcurl/release32;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>libcurl/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libcurl_a.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>libcurl/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libcurl_a.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>libcurl/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libcurl_a.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
58 changes: 58 additions & 0 deletions OPL Game Installer/OPL Game Installer.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="opl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="isoparser.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="lib9660\lib9660.c">
<Filter>Header Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="isoparser.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="utilities.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="opl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="lib9660\lib9660.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="OPL Game Installer.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="..\..\..\..\..\Downloads\PlayStation_logo.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions OPL Game Installer/OPL Game Installer.vcxproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>
104 changes: 104 additions & 0 deletions OPL Game Installer/isoparser.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#include "isoparser.h"
#include "utilities.h"

static FILE* isof;

static bool readsect(l9660_fs* fs, void* buf, uint32_t sector)
{
if (_fseeki64(isof, 2048 * sector, SEEK_SET)) {
fprintf(stderr, "Reading sector %u\n", sector);
perror("fseek");
return false;
}

if (fread(buf, 2048, 1, isof) != 1) {
fprintf(stderr, "Reading sector %u\n", sector);
perror("fread");
return false;
}

return true;
}

char* IsoParser::readIsoFile(const char* path, const char* insidePath) {
isof = fopen(path, "rb");
if (!isof) {
printf("[-] Failed to open '%s' path.\n", path);
return nullptr;
}

l9660_fs fs;
l9660_dir dir;
l9660_openfs(&fs, readsect);

l9660_fs_open_root(&dir, &fs);

l9660_file file;
l9660_openat(&file, &dir, insidePath);

size_t totalRead = 0;

char* content = nullptr;

while (true) {
char buf[128];
size_t bytesRead;
l9660_read(&file, buf, 128, &bytesRead);

if (bytesRead == 0) {
break;
}

content = new char[bytesRead];
std::memcpy(content, buf, bytesRead);
totalRead += bytesRead;
}

if (totalRead > 0) {
content[totalRead] = '\0';
}

fclose(isof);

return content;
}

char* IsoParser::parseConfig(const char* conf, const char* option) {
std::string strBuffer(conf);

size_t found = strBuffer.find(option);
if (found == std::string::npos) {
return nullptr;
}

std::string afterOption = strBuffer.substr(found);

size_t endOfLine = afterOption.find_first_of("\n");
if (endOfLine == std::string::npos) {
return nullptr;
}

std::string removeLines = strBuffer.substr(found, afterOption.find_first_of("\n") - 1);
std::string afterProp = removeLines.substr(strlen(option) + 3);

return stringToCharp(afterProp);
}

char* IsoParser::getGameID(const char* isoPath) {

char* config = IsoParser::readIsoFile(isoPath, "SYSTEM.CNF");
if (!config) {
return nullptr;
}

std::string boot = IsoParser::parseConfig(config, "BOOT2");
size_t p = boot.find_first_of("\\");
if (p == std::string::npos) {
return nullptr;
}

std::string boot2 = boot.substr(p + 1);
std::string gameId = boot2.substr(0, boot2.length() - 2);

return stringToCharp(gameId);
}
14 changes: 14 additions & 0 deletions OPL Game Installer/isoparser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include <iostream>
#include <sstream>

extern "C" {
#include "lib9660/lib9660.h"
}

namespace IsoParser {
char* readIsoFile(const char* path, const char* insidePath);
char* parseConfig(const char* conf, const char* option);
char* getGameID(const char* isoPath);
};
1 change: 1 addition & 0 deletions OPL Game Installer/lib9660
Submodule lib9660 added at 00d027
Loading

0 comments on commit ceb9db6

Please sign in to comment.