cpp parser for funs.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,6 @@
|
|||||||
/bin/
|
/bin/
|
||||||
/obj/
|
/obj/
|
||||||
/.vs/
|
/.vs/
|
||||||
|
Debug/
|
||||||
|
LegoBlobReader/LegoBlobReader.vcxproj.filters
|
||||||
|
LegoBlobReader/LegoBlobReader.vcxproj.user
|
||||||
|
77
LegoBlobReader/LegoBlobReader.cpp
Normal file
77
LegoBlobReader/LegoBlobReader.cpp
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
// LegoBlobReader.cpp : This file contains the 'main' function. Program execution begins and ends there.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <conio.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
typedef unsigned char byte;
|
||||||
|
|
||||||
|
static char const* FILE_NAME = "GAMEPROGRESS.broke.blob";
|
||||||
|
|
||||||
|
|
||||||
|
byte* ReadFileToBuffer(char const* filename, size_t* file_len)
|
||||||
|
{
|
||||||
|
FILE* fp = nullptr;
|
||||||
|
::fopen_s(&fp, filename, "r");
|
||||||
|
if (nullptr == fp) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
::fseek(fp, 0, SEEK_END);
|
||||||
|
size_t eof = ::ftell(fp);
|
||||||
|
::fseek(fp, 0, SEEK_SET);
|
||||||
|
|
||||||
|
byte* buffer = (byte*) ::malloc(eof);
|
||||||
|
if (nullptr != buffer) {
|
||||||
|
*file_len = ::fread(buffer, 1, eof, fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
::fclose(fp);
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DisplayProgress(byte* buffer, size_t len, size_t offset)
|
||||||
|
{
|
||||||
|
size_t bytes_to_show = len - offset;
|
||||||
|
bytes_to_show = std::min<size_t>(bytes_to_show, 16);
|
||||||
|
printf("At %u (0x%08x) into buffer... Next %u byte(s) are...\n> ", offset, offset, bytes_to_show);
|
||||||
|
for (size_t i = 0; i < bytes_to_show; ++i) {
|
||||||
|
byte b = buffer[offset + i];
|
||||||
|
printf("%02X ", b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ParseBuffer(byte* buffer, size_t len)
|
||||||
|
{
|
||||||
|
size_t offset = 0;
|
||||||
|
DisplayProgress(buffer, len, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
size_t file_len;
|
||||||
|
byte* buffer = ReadFileToBuffer(FILE_NAME, &file_len);
|
||||||
|
if (nullptr == buffer) {
|
||||||
|
printf("Failed to open file.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
ParseBuffer(buffer, file_len);
|
||||||
|
|
||||||
|
free(buffer);
|
||||||
|
printf("\n\n\n");
|
||||||
|
_getch();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
|
||||||
|
// Debug program: F5 or Debug > Start Debugging menu
|
||||||
|
|
||||||
|
// Tips for Getting Started:
|
||||||
|
// 1. Use the Solution Explorer window to add/manage files
|
||||||
|
// 2. Use the Team Explorer window to connect to source control
|
||||||
|
// 3. Use the Output window to see build output and other messages
|
||||||
|
// 4. Use the Error List window to view errors
|
||||||
|
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
|
||||||
|
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
|
147
LegoBlobReader/LegoBlobReader.vcxproj
Normal file
147
LegoBlobReader/LegoBlobReader.vcxproj
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
<?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>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>16.0</VCProjectVersion>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{5c4d0ba1-03c4-4615-b2cf-5857e4813e92}</ProjectGuid>
|
||||||
|
<RootNamespace>LegoBlobReader</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>v142</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</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|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(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>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="LegoBlobReader.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
@ -1,20 +1,44 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 17.0.32112.339
|
VisualStudioVersion = 16.0.32407.337
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LegoSkywalkerGameProgressParser", "LegoSkywalkerGameProgressParser.csproj", "{176F7D27-DFB9-4C4D-97E5-B4A3F5813977}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LegoSkywalkerGameProgressParser", "LegoSkywalkerGameProgressParser.csproj", "{176F7D27-DFB9-4C4D-97E5-B4A3F5813977}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LegoBlobReader", "LegoBlobReader\LegoBlobReader.vcxproj", "{5C4D0BA1-03C4-4615-B2CF-5857E4813E92}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{176F7D27-DFB9-4C4D-97E5-B4A3F5813977}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{176F7D27-DFB9-4C4D-97E5-B4A3F5813977}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{176F7D27-DFB9-4C4D-97E5-B4A3F5813977}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{176F7D27-DFB9-4C4D-97E5-B4A3F5813977}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{176F7D27-DFB9-4C4D-97E5-B4A3F5813977}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{176F7D27-DFB9-4C4D-97E5-B4A3F5813977}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{176F7D27-DFB9-4C4D-97E5-B4A3F5813977}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{176F7D27-DFB9-4C4D-97E5-B4A3F5813977}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
{176F7D27-DFB9-4C4D-97E5-B4A3F5813977}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{176F7D27-DFB9-4C4D-97E5-B4A3F5813977}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{176F7D27-DFB9-4C4D-97E5-B4A3F5813977}.Release|Any CPU.Build.0 = Release|Any CPU
|
{176F7D27-DFB9-4C4D-97E5-B4A3F5813977}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{176F7D27-DFB9-4C4D-97E5-B4A3F5813977}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{176F7D27-DFB9-4C4D-97E5-B4A3F5813977}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{176F7D27-DFB9-4C4D-97E5-B4A3F5813977}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{176F7D27-DFB9-4C4D-97E5-B4A3F5813977}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{5C4D0BA1-03C4-4615-B2CF-5857E4813E92}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||||
|
{5C4D0BA1-03C4-4615-B2CF-5857E4813E92}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{5C4D0BA1-03C4-4615-B2CF-5857E4813E92}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{5C4D0BA1-03C4-4615-B2CF-5857E4813E92}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{5C4D0BA1-03C4-4615-B2CF-5857E4813E92}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{5C4D0BA1-03C4-4615-B2CF-5857E4813E92}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{5C4D0BA1-03C4-4615-B2CF-5857E4813E92}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{5C4D0BA1-03C4-4615-B2CF-5857E4813E92}.Release|x64.Build.0 = Release|x64
|
||||||
|
{5C4D0BA1-03C4-4615-B2CF-5857E4813E92}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{5C4D0BA1-03C4-4615-B2CF-5857E4813E92}.Release|x86.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
Reference in New Issue
Block a user