mirror of
https://github.com/UnknownObject000/Xiaomi10-logo-editor.git
synced 2026-08-13 04:51:39 +08:00
Add files via upload
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30804.86
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LOGOIMGEditor", "LOGOIMGEditor\LOGOIMGEditor.vcxproj", "{03636210-291F-40AE-A519-CB5857387FB4}"
|
||||
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
|
||||
{03636210-291F-40AE-A519-CB5857387FB4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{03636210-291F-40AE-A519-CB5857387FB4}.Debug|x64.Build.0 = Debug|x64
|
||||
{03636210-291F-40AE-A519-CB5857387FB4}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{03636210-291F-40AE-A519-CB5857387FB4}.Debug|x86.Build.0 = Debug|Win32
|
||||
{03636210-291F-40AE-A519-CB5857387FB4}.Release|x64.ActiveCfg = Release|x64
|
||||
{03636210-291F-40AE-A519-CB5857387FB4}.Release|x64.Build.0 = Release|x64
|
||||
{03636210-291F-40AE-A519-CB5857387FB4}.Release|x86.ActiveCfg = Release|Win32
|
||||
{03636210-291F-40AE-A519-CB5857387FB4}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {619FA7EB-45FB-4BA8-AFB4-866CB3E729C0}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,115 @@
|
||||
// LOGOIMGEditor.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <stdio.h>
|
||||
|
||||
#define EXIT_MAIN(code,fmt,...) {printf("main() exited. Code %d\nMessage: ",code);printf(fmt,__VA_ARGS__);return code;};
|
||||
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
|
||||
offsets:
|
||||
00: 0x00000000 - 0x00004FFF - don't know
|
||||
01: 0x00005000 - 0x0073FD07 - image 1
|
||||
(ZEROS)
|
||||
02: 0x00740000 - 0x00E7AFD7 - image 2
|
||||
(ZEROS)
|
||||
03: 0x00E7B000 - 0x015B5FD7 - image 3
|
||||
(ZEROS)
|
||||
04: 0x015B6000 - 0x01820000 - image 4
|
||||
|
||||
*/
|
||||
|
||||
bool FileExist(string file)
|
||||
{
|
||||
fstream io(file.c_str(), ios::in);
|
||||
bool ret = io.is_open();
|
||||
io.close();
|
||||
return ret;
|
||||
}
|
||||
|
||||
int GetOffset(int img, bool front)
|
||||
{
|
||||
switch (img)
|
||||
{
|
||||
case 1:
|
||||
return (front ? 0x00005000 : 0x0073FD07);
|
||||
case 2:
|
||||
return (front ? 0x00740000 : 0x00E7AFD7);
|
||||
case 3:
|
||||
return (front ? 0x00E7B000 : 0x015B5FD7);
|
||||
case 4:
|
||||
return (front ? 0x015B6000 : 0x01820000);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc,char* argv[])
|
||||
{
|
||||
if (argc != 7)
|
||||
EXIT_MAIN(-32767, "This tool take 6 partmers insteaed of %d.\n[Usage] LOGOIMGEditor.exe [old_img_file] [new_img_file] [normal_bmp] [fastboot_bmp] [unlocked_bmp] [destroyed_bmp]\n", argc - 1);
|
||||
if (!FileExist(argv[1]))
|
||||
EXIT_MAIN(-65534, "Image file \"%s\" does not exist.\n", argv[1]);
|
||||
for (int i = 3; i < 7; i++)
|
||||
if (!FileExist(argv[i]))
|
||||
EXIT_MAIN(-65535, "BMP file \"%s\" does not exist.\n", argv[i]);
|
||||
const string input_file_path = argv[1];
|
||||
const string output_file_path = argv[2];
|
||||
fstream input(input_file_path.c_str(), ios::in | ios::binary);
|
||||
if (!input.is_open())
|
||||
EXIT_MAIN(-1, "Cannot open input file\n");
|
||||
fstream output(output_file_path.c_str(), ios::out | ios::binary);
|
||||
if (!output.is_open())
|
||||
EXIT_MAIN(-2, "Cannot open output file\n");
|
||||
char buffer[1];
|
||||
int bytecnt = 0x00004FFF;
|
||||
//I don't know the meaning of bytes before 0x00004FFFF, so just copy them.
|
||||
printf("Copying bytes before 0x00004FFF......\n");
|
||||
for (int i = 0; i < 0x00004FFF; i++)
|
||||
{
|
||||
input.read(buffer, 1);
|
||||
output.write(buffer, 1);
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
}
|
||||
input.close();
|
||||
//Repeat:write every image to the new .img file, and add some zeros bewteen two image.
|
||||
for (int i = 3; i < 7; i++)
|
||||
{
|
||||
printf("Processing image %d (%s)......\n", i - 2, argv[i]);
|
||||
input.open(argv[i], ios::in | ios::binary);
|
||||
if (!input.is_open())
|
||||
{
|
||||
output.close();
|
||||
EXIT_MAIN(-3, "Cannot open input image \"%s\"\n", argv[i]);
|
||||
}
|
||||
printf("Filling zeros between images......\n");
|
||||
while (bytecnt < GetOffset(i - 2, true))
|
||||
{
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
output.write(buffer, 1);
|
||||
bytecnt++;
|
||||
}
|
||||
printf("Writing image......\n");
|
||||
while (!input.eof())
|
||||
{
|
||||
input.read(buffer, 1);
|
||||
output.write(buffer, 1);
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
bytecnt++;
|
||||
}
|
||||
input.close();
|
||||
}
|
||||
//fill up zeros in the end of the file.
|
||||
printf("Filling zeros at the end of file......\n");
|
||||
while (bytecnt < GetOffset(4, false))
|
||||
{
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
output.write(buffer, 1);
|
||||
bytecnt++;
|
||||
}
|
||||
output.close();
|
||||
EXIT_MAIN(0, "Successfully finished.\n");
|
||||
}
|
||||
@@ -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>{03636210-291f-40ae-a519-cb5857387fb4}</ProjectGuid>
|
||||
<RootNamespace>LOGOIMGEditor</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="LOGOIMGEditor.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<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="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<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="LOGOIMGEditor.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user