├── .gitignore ├── README.md ├── ZeldaHWLSaveEditor.sln ├── ZeldaHWLSaveEditor.v12.suo ├── ZeldaHWLSaveEditor.vcxproj ├── ZeldaHWLSaveEditor.vcxproj.filters ├── ZeldaHWLSaveEditor.vcxproj.user ├── ZeldaHWLSaveEditorGUI.vcxproj ├── ZeldaHWLSaveEditorGUI.vcxproj.filters ├── ZeldaHWLSaveEditorGUI.vcxproj.user ├── settings.cfg └── source ├── CMakeLists.txt ├── console ├── CMakeLists.txt ├── ZeldaHWLSaveEditorConsole.rc ├── main.cpp └── resource.h ├── core ├── CMakeLists.txt ├── HWLAdventureModeItems.cpp ├── HWLAdventureModeItems.h ├── HWLAdventureModeMaps.cpp ├── HWLAdventureModeMaps.h ├── HWLConfig.cpp ├── HWLConfig.h ├── HWLException.cpp ├── HWLException.h ├── HWLFairy.cpp ├── HWLFairy.h ├── HWLFairyFood.cpp ├── HWLFairyFood.h ├── HWLGeneral.cpp ├── HWLGeneral.h ├── HWLHttp.cpp ├── HWLHttp.h ├── HWLMaterial.cpp ├── HWLMaterial.h ├── HWLPlayer.cpp ├── HWLPlayer.h ├── HWLSaveEditor.cpp ├── HWLSaveEditor.h ├── HWLSaveEditorCore.cpp ├── HWLSaveEditorCore.h ├── HWLWeapon.cpp ├── HWLWeapon.h └── res │ └── ZeldaHWLSaveEditorGUI.ico ├── gui ├── ZeldaAboutDlg.cpp ├── ZeldaAboutDlg.h ├── ZeldaCheckForUpdatesDlg.cpp ├── ZeldaCheckForUpdatesDlg.h ├── ZeldaConfigWeaponCopyDlg.cpp ├── ZeldaConfigWeaponCopyDlg.h ├── ZeldaEditAdventureModeItem.cpp ├── ZeldaEditAdventureModeItem.h ├── ZeldaEditAdventureModeMaps.cpp ├── ZeldaEditAdventureModeMaps.h ├── ZeldaEditCharaOverviewDlg.cpp ├── ZeldaEditCharaOverviewDlg.h ├── ZeldaEditCharaStatsDlg.cpp ├── ZeldaEditCharaStatsDlg.h ├── ZeldaEditCharaWeaponsDlg.cpp ├── ZeldaEditCharaWeaponsDlg.h ├── ZeldaEditFairyDlg.cpp ├── ZeldaEditFairyDlg.h ├── ZeldaEditFairyFoods.cpp ├── ZeldaEditFairyFoods.h ├── ZeldaEditGeneralDlg.cpp ├── ZeldaEditGeneralDlg.h ├── ZeldaEditMaterials.cpp ├── ZeldaEditMaterials.h ├── ZeldaHWLSaveEditorGUI.cpp ├── ZeldaHWLSaveEditorGUI.h ├── ZeldaHWLSaveEditorGUI.rc ├── res │ └── ZeldaHWLSaveEditorGUI.rc2 ├── resource.h ├── stdafx.cpp ├── stdafx.h └── targetver.h └── libs ├── CMakeLists.txt └── HTTP_Client ├── API ├── HTTPClient.c ├── HTTPClient.h ├── HTTPClientAuth.c ├── HTTPClientAuth.h ├── HTTPClientCommon.h ├── HTTPClientString.c ├── HTTPClientString.h ├── HTTPClientWrapper.c └── HTTPClientWrapper.h ├── CHTTP_Client.cpp ├── CHTTP_Client.h ├── CMakeLists.txt └── License.txt /.gitignore: -------------------------------------------------------------------------------- 1 | *.aps 2 | *.aps 3 | *.aps 4 | *.aps -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://jenkins.nedron92.de/job/HWL_githubCompileAuto/badge/icon)](https://jenkins.nedron92.de/job/HWL_githubCompileAuto/) 2 | 3 | # HWL-SaveEditor (3DS) 4 | This is an Save-Editor for the game Hyrule Warriors Legends (Nintendo 3DS) 5 | 6 | It's written in C++ and with MS Visual Studio 2013. You need that compiler for compiling the gui. (MFC application). 7 | But there are also CMakeLists-files to compile the console-version under linux with cmake. 8 | 9 | The main-files are located at source/core (all main functions are located here). 10 | 11 | ## How to Build under Linux 12 | There are some prerequisites before you can compile it. 13 | Make sure, that you have `cmake`, `make`, `gcc` and `g++`. 14 | You need CMake >=2.8, GCC/G++ >= 5.0 15 | 16 | After that check compiling under linux is very easily. 17 | In terminal/console change to the source-directory and then run these commands: 18 | `mkdir output && cd output` 19 | `cmake ..` 20 | `make` 21 | 22 | The binary executable is within the `output`-dir under `bin`. 23 | 24 | 25 | ## Prerequisites 26 | You should have a Version of SaveDataFiler (or able to use .cia files on your 3DS), JK's Save Manager (.cia) or able to run homebrew to get your savefile of the game. 27 | Possible Homebrew for exporting a savefile: svdt, 3DS Save Manager and/or JK3DSTool (as a .3dsx file), search for it with your favourite search-engine ;) 28 | If you not able to run homebrew yet, then visit http://smealum.github.io/3ds/ for more information. 29 | 30 | ## How to use it? 31 | First, download the latest stable release! 32 | Once you have your savefile (normally called "zmha.bin"), copy to your PC, made a backup of that savefile before you edit anything, run the editor, open the savefile and change what you want, save the file, copy it back to your 3DS SD-Card and import it back with the programm, you used before to get the savefile. 33 | 34 | 35 | ## How to change the configfile (settings.cfg - since Version 3.1+) 36 | Open this file with your favourite text-editor like Wordpad or Notepad++. 37 | There some parameters you can change to change the behaviour of the editor itself: 38 | * `autoUpdateCheck` - a boolean (true/false) param. If its set to 'true', the editor check at every start if there is an new stable version and let you know if there is one. Default: false 39 | * `autoTrim` - a boolean (true/false) param. If its set to 'true', the editor will trim the current opened savefile if its too long (to avoid some errors). Default: true 40 | * `DlcSafetyCheck` - a boolean (true/false) param. If its set to 'true', the editor checks all things if there are compatible with your installed DLCs that were found. It will cut things, that you can't or should'nt edit without a specific DLC. 41 | Default: true (and only deactivate it, if the DLC-identification don't work correctly with your savefile, be careful). 42 | * `createBackupFileOnOpening` - a boolean (true/false) param. If its set to 'true', the editor create an automatically a backup-file of your opened savefile (if it's could successfully opened). Default: true 43 | * `openLastSaveFileOnStart` - a boolean (true/false) param. If its set to 'true', the editor will opened your last opened saveFile on the next start (you can define it yourself, see next). 44 | * `LastSaveFile` - a string (text) param. This parameter contain the path (normally the fullpath) to the last opened savefile. 45 | Something like: `C:\Users\da da\Desktop\zmha.bin`. Also relative paths will work. This parameter will be ignored if `openLastSaveFileOnStart` is deactivated (set to 'false'). Default: zmha.bin 46 | * `useHTTPProxy` - a boolean (true/false) param. If its set to 'true', the editor will use the specified proxy-settings. BUT only real HTTP-PROXIES are supported, no Socks-proxy. Default: false 47 | * `ProxyHost` - a string (text) param. This parameter contain the IP adress of your used proxy-server. Default: 127.0.0.1 48 | * `ProxyPort` - a string (text) param. This parameter contain the Port of your used proxy-server. Default: 8080 49 | 50 | If you have problems after editing your configfile, simply delete it. The editor will recognize it and will create a new default configfile on start. 51 | 52 | ## Nightly-Builds 53 | If you don't want to wait for a new stable-release, then you can check the nightly-build-server. 54 | It will build automatically windows- and linux-builds every night (about 3 o'clock CET) after there was a new commit to 55 | this repository. 56 | But use them on your own risk, the nightly-builds can be unstable and with more failures/bugs as a new release. 57 | You can download them on https://nightly.nedron92.de/hwl_save-editor/ 58 | 59 | 60 | ## Questions? 61 | Ask me wherever you want, but basically at http://gbatemp.net/ (my name there is also nedron92). 62 | You can also ask your question within the main-thread: 63 | http://gbatemp.net/threads/release-hyrule-warriors-legends-save-editor-ntr-plugin.411349/ 64 | 65 | ## Failures, Bugs etc. 66 | If you find any kind of failures, bugs and other then post it in the main-thread, which I named above. 67 | If you are a programmer, correct the mistake and send me a request here at github. 68 | 69 | ## Credits 70 | main-src (core/console/gui): nedron92, 2016 71 | lib/HTTP-Client: Eitan Michaelson, Bob Wirka, 2014 (many thanks for that lightweight C-Lib) 72 | 73 | Have fun^^ 74 | -------------------------------------------------------------------------------- /ZeldaHWLSaveEditor.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZeldaHWLSaveEditorConsole", "ZeldaHWLSaveEditor.vcxproj", "{B3A66ECD-1D60-4BCD-B5EF-ECD2C5BEE3D5}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZeldaHWLSaveEditorGUI", "ZeldaHWLSaveEditorGUI.vcxproj", "{A33FA152-0BFA-4F0D-888E-0744DC1C2565}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Win32 = Debug|Win32 13 | Release|Win32 = Release|Win32 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {B3A66ECD-1D60-4BCD-B5EF-ECD2C5BEE3D5}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {B3A66ECD-1D60-4BCD-B5EF-ECD2C5BEE3D5}.Debug|Win32.Build.0 = Debug|Win32 18 | {B3A66ECD-1D60-4BCD-B5EF-ECD2C5BEE3D5}.Release|Win32.ActiveCfg = Release|Win32 19 | {B3A66ECD-1D60-4BCD-B5EF-ECD2C5BEE3D5}.Release|Win32.Build.0 = Release|Win32 20 | {A33FA152-0BFA-4F0D-888E-0744DC1C2565}.Debug|Win32.ActiveCfg = Debug|Win32 21 | {A33FA152-0BFA-4F0D-888E-0744DC1C2565}.Debug|Win32.Build.0 = Debug|Win32 22 | {A33FA152-0BFA-4F0D-888E-0744DC1C2565}.Release|Win32.ActiveCfg = Release|Win32 23 | {A33FA152-0BFA-4F0D-888E-0744DC1C2565}.Release|Win32.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /ZeldaHWLSaveEditor.v12.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedron92/HWL-SaveEditor/4259e42b4ee6d643859fc218e436c20c337cb358/ZeldaHWLSaveEditor.v12.suo -------------------------------------------------------------------------------- /ZeldaHWLSaveEditor.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {B3A66ECD-1D60-4BCD-B5EF-ECD2C5BEE3D5} 15 | ZeldaHWLSaveEditor 16 | ZeldaHWLSaveEditorConsole 17 | 18 | 19 | 20 | Application 21 | true 22 | v120 23 | MultiByte 24 | 25 | 26 | Application 27 | false 28 | v120 29 | true 30 | MultiByte 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | HWLSaveEditor 44 | tmp\$(ProjectName)\$(Configuration)\ 45 | true 46 | 47 | 48 | HWLSaveEditor 49 | tmp\$(ProjectName)\$(Configuration)\ 50 | false 51 | 52 | 53 | 54 | Level3 55 | Disabled 56 | true 57 | _CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 58 | MultiThreadedDebug 59 | 60 | 61 | true 62 | bin\$(Configuration)\$(Platform)\$(TargetName)$(TargetExt) 63 | bin\$(Configuration)\$(Platform)\$(TargetName).pdb 64 | ws2_32.lib;%(AdditionalDependencies) 65 | 66 | 67 | 68 | 69 | 70 | 71 | rd /s /q "$(IntDir)" && rd /s /q "$(TargetDir)" 72 | 73 | 74 | 75 | 76 | Level3 77 | MaxSpeed 78 | true 79 | true 80 | true 81 | _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 82 | 83 | 84 | true 85 | true 86 | bin\$(Configuration)\$(Platform)\$(TargetName)$(TargetExt) 87 | bin\$(Configuration)\$(Platform)\$(TargetName).pdb 88 | ws2_32.lib;%(AdditionalDependencies) 89 | 90 | 91 | 92 | 93 | 94 | 95 | rd /s /q "$(IntDir)" && rd /s /q "$(TargetDir)" 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /ZeldaHWLSaveEditor.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {4dd23ed0-efdd-42c9-93dc-b478c2ddc5e7} 18 | 19 | 20 | {3da354c8-7e7a-47ad-a82d-0038acdbdf71} 21 | 22 | 23 | {eb5f0e1b-3e61-4a0b-8c4c-3596d5512d50} 24 | 25 | 26 | {c177ccac-d237-417b-bd1f-8339ceefa334} 27 | 28 | 29 | {17370d15-9518-4ba8-bcf0-4151278fb40c} 30 | 31 | 32 | {2909c556-1735-4fb9-9d0b-69be32a63931} 33 | 34 | 35 | {48a57311-9998-4a10-97fc-3f107474c35a} 36 | 37 | 38 | {49a61997-1061-4f15-9ec6-3303f70a811d} 39 | 40 | 41 | {b2a4aaa8-2cef-4c02-9754-571ac0bfe680} 42 | 43 | 44 | {5266e919-a483-441b-a6f6-e927470129cc} 45 | 46 | 47 | 48 | 49 | Quelldateien\core 50 | 51 | 52 | Quelldateien\core 53 | 54 | 55 | Quelldateien\core 56 | 57 | 58 | Quelldateien\core 59 | 60 | 61 | Quelldateien\core 62 | 63 | 64 | Quelldateien\core 65 | 66 | 67 | Quelldateien\core 68 | 69 | 70 | Quelldateien\core 71 | 72 | 73 | Quelldateien\core 74 | 75 | 76 | Quelldateien\core 77 | 78 | 79 | Quelldateien\console 80 | 81 | 82 | Quelldateien\libs\HTTP_Client\API 83 | 84 | 85 | Quelldateien\libs\HTTP_Client\API 86 | 87 | 88 | Quelldateien\libs\HTTP_Client\API 89 | 90 | 91 | Quelldateien\libs\HTTP_Client\API 92 | 93 | 94 | Quelldateien\libs\HTTP_Client 95 | 96 | 97 | Quelldateien\core 98 | 99 | 100 | Quelldateien\core 101 | 102 | 103 | Quelldateien\core 104 | 105 | 106 | 107 | 108 | Headerdateien\core 109 | 110 | 111 | Headerdateien\core 112 | 113 | 114 | Headerdateien\core 115 | 116 | 117 | Headerdateien\core 118 | 119 | 120 | Headerdateien\core 121 | 122 | 123 | Headerdateien\core 124 | 125 | 126 | Headerdateien\core 127 | 128 | 129 | Headerdateien\core 130 | 131 | 132 | Headerdateien\core 133 | 134 | 135 | Headerdateien\core 136 | 137 | 138 | Headerdateien\console 139 | 140 | 141 | Headerdateien\libs\HTTP_Client\API 142 | 143 | 144 | Headerdateien\libs\HTTP_Client\API 145 | 146 | 147 | Headerdateien\libs\HTTP_Client\API 148 | 149 | 150 | Headerdateien\libs\HTTP_Client\API 151 | 152 | 153 | Headerdateien\libs\HTTP_Client\API 154 | 155 | 156 | Headerdateien\libs\HTTP_Client 157 | 158 | 159 | Headerdateien\core 160 | 161 | 162 | Headerdateien\core 163 | 164 | 165 | Headerdateien\core 166 | 167 | 168 | 169 | 170 | Ressourcendateien 171 | 172 | 173 | 174 | 175 | Ressourcendateien 176 | 177 | 178 | -------------------------------------------------------------------------------- /ZeldaHWLSaveEditor.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WindowsLocalDebugger 5 | bin\$(Configuration)\$(Platform)\$(TargetName)$(TargetExt) 6 | $(ProjectDir) 7 | 8 | 9 | bin\$(Configuration)\$(Platform)\$(TargetName)$(TargetExt) 10 | WindowsLocalDebugger 11 | 12 | -------------------------------------------------------------------------------- /ZeldaHWLSaveEditorGUI.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {A33FA152-0BFA-4F0D-888E-0744DC1C2565} 15 | ZeldaHWLSaveEditorGUI 16 | 17 | 18 | 19 | Application 20 | true 21 | v120 22 | Unicode 23 | Static 24 | 25 | 26 | Application 27 | false 28 | v120 29 | true 30 | Unicode 31 | Static 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | HWLSaveEditorGUI 45 | tmp\$(ProjectName)\$(Configuration)\ 46 | false 47 | 48 | 49 | HWLSaveEditorGUI 50 | tmp\$(ProjectName)\$(Configuration)\ 51 | true 52 | 53 | 54 | 55 | Level3 56 | Disabled 57 | true 58 | NotUsing 59 | WIN32;_WINDOWS;DEBUG;_CRT_SECURE_NO_WARNINGS;__MFC__;%(PreprocessorDefinitions) 60 | 61 | 62 | true 63 | bin\$(Configuration)\$(Platform)\$(TargetName)$(TargetExt) 64 | bin\$(Configuration)\$(Platform)\$(TargetName).pdb 65 | ws2_32.lib;%(AdditionalDependencies) 66 | 67 | 68 | rd /s /q "$(IntDir)" && rd /s /q "$(TargetDir)" 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | Level3 77 | MaxSpeed 78 | true 79 | true 80 | true 81 | WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_WARNINGS;__MFC__;%(PreprocessorDefinitions) 82 | MultiThreaded 83 | NotUsing 84 | 85 | 86 | true 87 | true 88 | bin\$(Configuration)\$(Platform)\$(TargetName)$(TargetExt) 89 | bin\$(Configuration)\$(Platform)\$(TargetName).pdb 90 | ws2_32.lib;%(AdditionalDependencies) 91 | 92 | 93 | rd /s /q "$(IntDir)" && rd /s /q "$(TargetDir)" 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | -------------------------------------------------------------------------------- /ZeldaHWLSaveEditorGUI.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {c88cf407-5c15-4107-9883-4ba3227921d7} 18 | 19 | 20 | {0e74be7a-19ee-470f-8196-d263c9562eb8} 21 | 22 | 23 | {00a3f4b5-a320-4e92-8804-012c1baa7fa5} 24 | 25 | 26 | {e5db2d5e-aaae-4856-9e0d-f22a4a5274a2} 27 | 28 | 29 | {be2a0fb2-50b3-46b7-8035-9ebcc78519a2} 30 | 31 | 32 | {6ea3465a-c258-44f3-9237-1f1b1aa03a8b} 33 | 34 | 35 | {a5143f7c-85a8-45e5-98e6-22083550474c} 36 | 37 | 38 | {9cca8664-7f7a-4e8f-8651-bf10e18cfe1a} 39 | 40 | 41 | {abe18c5b-2161-4bac-861a-b5b4e3a65841} 42 | 43 | 44 | {da3d180e-6b0e-4eeb-94dd-7c2fd7774190} 45 | 46 | 47 | 48 | 49 | Headerdateien\core 50 | 51 | 52 | Headerdateien\core 53 | 54 | 55 | Headerdateien\core 56 | 57 | 58 | Headerdateien\core 59 | 60 | 61 | Headerdateien\core 62 | 63 | 64 | Headerdateien\core 65 | 66 | 67 | Headerdateien\core 68 | 69 | 70 | Headerdateien\core 71 | 72 | 73 | Headerdateien\core 74 | 75 | 76 | Headerdateien\core 77 | 78 | 79 | Headerdateien\gui 80 | 81 | 82 | Headerdateien\gui 83 | 84 | 85 | Headerdateien\gui 86 | 87 | 88 | Headerdateien\gui 89 | 90 | 91 | Headerdateien\gui 92 | 93 | 94 | Headerdateien\gui 95 | 96 | 97 | Headerdateien\gui 98 | 99 | 100 | Headerdateien\gui 101 | 102 | 103 | Headerdateien\gui 104 | 105 | 106 | Headerdateien\gui 107 | 108 | 109 | Headerdateien\gui 110 | 111 | 112 | Headerdateien\libs\HTTP_Client\API 113 | 114 | 115 | Headerdateien\libs\HTTP_Client\API 116 | 117 | 118 | Headerdateien\libs\HTTP_Client\API 119 | 120 | 121 | Headerdateien\libs\HTTP_Client\API 122 | 123 | 124 | Headerdateien\libs\HTTP_Client\API 125 | 126 | 127 | Headerdateien\libs\HTTP_Client 128 | 129 | 130 | Headerdateien\core 131 | 132 | 133 | Headerdateien\gui 134 | 135 | 136 | Headerdateien\core 137 | 138 | 139 | Headerdateien\gui 140 | 141 | 142 | Headerdateien\gui 143 | 144 | 145 | Headerdateien\gui 146 | 147 | 148 | Headerdateien\core 149 | 150 | 151 | 152 | 153 | Quelldateien\core 154 | 155 | 156 | Quelldateien\core 157 | 158 | 159 | Quelldateien\core 160 | 161 | 162 | Quelldateien\core 163 | 164 | 165 | Quelldateien\core 166 | 167 | 168 | Quelldateien\core 169 | 170 | 171 | Quelldateien\core 172 | 173 | 174 | Quelldateien\core 175 | 176 | 177 | Quelldateien\core 178 | 179 | 180 | Quelldateien\core 181 | 182 | 183 | Quelldateien\gui 184 | 185 | 186 | Quelldateien\gui 187 | 188 | 189 | Quelldateien\gui 190 | 191 | 192 | Quelldateien\gui 193 | 194 | 195 | Quelldateien\gui 196 | 197 | 198 | Quelldateien\gui 199 | 200 | 201 | Quelldateien\gui 202 | 203 | 204 | Quelldateien\gui 205 | 206 | 207 | Quelldateien\gui 208 | 209 | 210 | Quelldateien\libs\HTTP_Client\API 211 | 212 | 213 | Quelldateien\libs\HTTP_Client\API 214 | 215 | 216 | Quelldateien\libs\HTTP_Client\API 217 | 218 | 219 | Quelldateien\libs\HTTP_Client\API 220 | 221 | 222 | Quelldateien\libs\HTTP_Client 223 | 224 | 225 | Quelldateien\core 226 | 227 | 228 | Quelldateien\gui 229 | 230 | 231 | Quelldateien\core 232 | 233 | 234 | Quelldateien\gui 235 | 236 | 237 | Quelldateien\gui 238 | 239 | 240 | Quelldateien\gui 241 | 242 | 243 | Quelldateien\core 244 | 245 | 246 | 247 | 248 | Ressourcendateien 249 | 250 | 251 | 252 | 253 | Ressourcendateien 254 | 255 | 256 | -------------------------------------------------------------------------------- /ZeldaHWLSaveEditorGUI.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | bin\$(Configuration)\$(Platform)\$(TargetName)$(TargetExt) 5 | WindowsLocalDebugger 6 | 7 | 8 | bin\$(Configuration)\$(Platform)\$(TargetName)$(TargetExt) 9 | WindowsLocalDebugger 10 | 11 | 12 | false 13 | 14 | -------------------------------------------------------------------------------- /settings.cfg: -------------------------------------------------------------------------------- 1 | [General] 2 | autoUpdateCheck=false 3 | autoTrim=true 4 | DlcSafetyCheck=true 5 | createBackupFileOnOpening=true 6 | openLastSaveFileOnStart=false 7 | LastSaveFile=zmha.bin 8 | useHTTPProxy=false 9 | 10 | [HTTP] 11 | ProxyHost=127.0.0.1 12 | ProxyPort=8080 13 | -------------------------------------------------------------------------------- /source/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #name the project 2 | project(HWLSaveEditor) 3 | 4 | #set needed ENV-variables to the right DIRs 5 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) 6 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) 7 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 8 | 9 | #compile with c++14, cause we need it 10 | #and include sub-dirs 11 | ADD_DEFINITIONS(-std=c++14) 12 | add_subdirectory(libs) 13 | add_subdirectory(core) 14 | add_subdirectory(console) 15 | 16 | #check if own URL will be used, default OFF 17 | option(USE_OWN_URLS "Use your own URLs for some HTTP-Requests" OFF) 18 | 19 | if(USE_OWN_URLS) 20 | #add messager..... 21 | MESSAGE(STATUS "Your using USE_OWN_URLS") 22 | SET(VERSION_CHECK_NIGHTLY_HTTP_URL '\"http://nightly.nedron92.de/hwl_save-editor/builds/version_nightly.txt\"' CACHE STRING "Own Version-Nighly-Check-URL") 23 | SET(NIGHTLY_URL '\"https://nightly.nedron92.de/hwl_save-editor/\"' CACHE STRING "Own Nightly-Server-URL") 24 | 25 | add_definitions( -DVERSION_CHECK_NIGHTLY_HTTP_URL=${VERSION_CHECK_NIGHTLY_HTTP_URL} ) 26 | add_definitions( -DNIGHTLY_URL=${NIGHTLY_URL} ) 27 | 28 | endif() 29 | -------------------------------------------------------------------------------- /source/console/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #create an executable-file of main.cpp 2 | add_executable(HWLSaveEditor main.cpp) 3 | 4 | #link the created static-lib to the executable-file 5 | target_link_libraries(HWLSaveEditor -lpthread) 6 | target_link_libraries(HWLSaveEditor core) 7 | -------------------------------------------------------------------------------- /source/console/ZeldaHWLSaveEditorConsole.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedron92/HWL-SaveEditor/4259e42b4ee6d643859fc218e436c20c337cb358/source/console/ZeldaHWLSaveEditorConsole.rc -------------------------------------------------------------------------------- /source/console/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedron92/HWL-SaveEditor/4259e42b4ee6d643859fc218e436c20c337cb358/source/console/resource.h -------------------------------------------------------------------------------- /source/core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #add all .cpp files of the core folder to the Variable "HWLSaveSrc" 2 | file(GLOB HWLSaveSrc 3 | "*.cpp" 4 | ) 5 | 6 | #create a static library from core-sources 7 | add_library(core STATIC ${HWLSaveSrc}) 8 | target_link_libraries(core http_client) 9 | -------------------------------------------------------------------------------- /source/core/HWLAdventureModeItems.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | //needed for including in a MFC-App 5 | #ifdef __MFC__ 6 | #include "../gui/stdafx.h" 7 | #endif // __MFC__ 8 | 9 | //include the correct header-file 10 | #include "HWLAdventureModeItems.h" 11 | 12 | //use the project-namespace 13 | using namespace HWLSaveEdit; 14 | 15 | /* @var vs_amItems vector for holding all names of AdventureMode-Items */ 16 | const vector HWLAdventureModeItems::vs_amItems = 17 | { 18 | "Compass", //Adventure-Map Items Begin 19 | "Bombs", 20 | "Candle", 21 | "Ladder", 22 | "Power Bracelet", 23 | "Water Bombs", 24 | "Digging Mitts", 25 | "Ice Arrow", 26 | "Raft", 27 | "Hookshot", 28 | "Recorder", 29 | "Goddess's Harp", //Adventure-Map Items End 30 | 31 | "Compass", //GreatSea-Map Items Begin 32 | "Hookshot", 33 | "Wind Waker", 34 | "Cannon", 35 | "Boomerang", 36 | "Hero's Bow", 37 | "Grappling Hook", 38 | "Hyoi Pears", 39 | "Deku Leaf", 40 | "Sea Chart", 41 | "Power Bracelet", 42 | "Hammer", //GreatSea-Map Items End 43 | 44 | "Compass", //MasterQuest-Map Items Begin 45 | "Bombs", 46 | "Candle", 47 | "Ladder", 48 | "Power Bracelet", 49 | "Water Bombs", 50 | "Digging Mitts", 51 | "Ice Arrow", 52 | "Raft", 53 | "Hookshot", 54 | "Recorder", 55 | "Goddess's Harp", //MasterQuest-Map Items End 56 | 57 | "Compass", //Twilight-Map Items Begin 58 | "Bombs", 59 | "Water Bombs", 60 | "Digging Mitts", 61 | "Lantern", 62 | "Jar", 63 | "Fishing Rod", 64 | "Clawshot", 65 | "Spinner", 66 | "Ooccoo", 67 | "Tears of Light", 68 | "Tears of Twilight", //Twilight-Map Items End 69 | 70 | "Compass", //Termina-Map Items Begin 71 | "Bombs", 72 | "Ice Arrow", 73 | "Song of Time", 74 | "Song of Time (Inv.)", 75 | "Deku Stick", 76 | "Deku Mask", 77 | "Goron Mask", 78 | "Zora Mask", 79 | "Mask of Truth", 80 | "Majora's Mask", 81 | "Giants", //Termina-Map Items End 82 | 83 | //only 1st DLC: Master Wind Waker DLC 84 | "Compass", //MasterWindWaker-Map Items Begin 85 | "Hookshot", 86 | "Wind Waker", 87 | "Cannon", 88 | "Boomerang", 89 | "Hero's Bow", 90 | "Grappling Hook", 91 | "Hyoi Pears", 92 | "Deku Leaf", 93 | "Sea Chart", 94 | "Power Bracelet", 95 | "Hammer", //MasterWindWaker-Map Items End 96 | 97 | //only 2nd DLC: Link's Awakening DLC 98 | "Compass", //KoholintIsland-Map Items Begin 99 | "Full Moon Cello", 100 | "Conch Horn", 101 | "Sea Lily Bell", 102 | "Surf Harp", 103 | "Wind Marimba", 104 | "Coral Triangle", 105 | "Organ of Evening Calm", 106 | "Thunder Drum", 107 | "Grandpa Ulrira", 108 | "Power Bracelet", 109 | "Magic Powder", //KoholintIsland-Map Items End 110 | 111 | //only 3rd DLC: Phantom Hourglass & Spirit Tracks DLC 112 | "Compass", //GrandTravels-Map Items Begin 113 | "Whirlwind", 114 | "Fishing Rod", 115 | "Cannon", 116 | "Railway Track", 117 | "Cyclone Slate", 118 | "S.S. Linebeck", 119 | "Iron Ship", 120 | "Golden Ship", 121 | "Spirit Train", 122 | "Steel Train", 123 | "Golden Train", //GrandTravels-Map Items End 124 | 125 | //only 4th DLC: A Link Between Worlds DLC 126 | "Bomb", //Lorule-Map Items Begin 127 | "Wall Painting", 128 | "Power Glove", 129 | "Fire Rod", 130 | "Tornado-Rod", 131 | "Ice-Rod", 132 | "Sand-Rod", 133 | "Baby Maimai", 134 | "Hammer", 135 | "Boomerang", 136 | "Bow", 137 | "Hookshot", //Lorule-Map Items End 138 | 139 | }; 140 | 141 | /* @var amItemValueMax maximal-value of an AdventureMode-Item */ 142 | const int HWLAdventureModeItems::amItemValueMax = 5; 143 | 144 | 145 | 146 | /** 147 | * Only the initialization of the normal-constructor 148 | */ 149 | HWLAdventureModeItems::HWLAdventureModeItems(int i_id, int i_offset, int i_map_id) 150 | { 151 | //set or calculate all needed members 152 | this->i_id = i_id; 153 | this->s_name = this->vs_amItems[this->i_id]; 154 | this->i_offset = i_offset; 155 | this->i_map_id = i_map_id; 156 | this->i_value = this->calc_value(); 157 | } 158 | 159 | 160 | /** 161 | * Only the initialization of the normal-destructor 162 | */ 163 | HWLAdventureModeItems::~HWLAdventureModeItems() 164 | { 165 | } 166 | 167 | 168 | 169 | /** 170 | * This method calculates the current AM-Item value 171 | * 172 | * @return int the current material-value 173 | * 174 | */ 175 | int HWLAdventureModeItems::calc_value() 176 | { 177 | //declare/define needed variables 178 | string s_amItem_value; 179 | int i_amItem_offset = this->i_offset; 180 | 181 | //get hex-value from the file-content holder and convert it to int 182 | s_amItem_value = this->getHexStringFromFileContent(i_amItem_offset, this->amItemOffsetLength); 183 | int i_amItem_value = this->HexStringToInt(s_amItem_value); 184 | 185 | //return the current int-value 186 | return i_amItem_value; 187 | } 188 | 189 | 190 | 191 | /** 192 | * This method set the current AM-Item value 193 | * to the file-content holder 194 | * 195 | */ 196 | void HWLAdventureModeItems::save_value() 197 | { 198 | //declare/define needed variables 199 | int i_value_tmp = this->i_value; 200 | string s_amItem_value; 201 | int i_amItem_offset = this->i_offset; 202 | 203 | //convert the current integer-value to hex and add needed zeros, if we 204 | //don't have the complete length (calculate with offset-length multiplied by 2) 205 | s_amItem_value = this->intToHexString(i_value_tmp, false); 206 | this->addZeroToHexString(s_amItem_value, this->amItemOffsetLength * 2); 207 | 208 | //set converted hex-value to the file-content holder 209 | this->setHexStringToFileContent(s_amItem_value, i_amItem_offset); 210 | } 211 | 212 | 213 | 214 | /** 215 | * Setter for the AM-Item value 216 | * 217 | * @var int i_value AM-Item value to set 218 | * 219 | */ 220 | void HWLAdventureModeItems::set_value(int i_value) 221 | { 222 | //check if AM-Item value smaller then 0, then set it directly to 0 223 | //also check for the maximal-value 224 | if (i_value < 0) 225 | i_value = 0; 226 | else if (i_value > this->amItemValueMax) 227 | i_value = this->amItemValueMax; 228 | 229 | this->i_value = i_value; 230 | 231 | } 232 | 233 | 234 | 235 | /** 236 | * Getter for the AM-Item-name 237 | * 238 | * @return string the name of the AM-Item 239 | * 240 | */ 241 | string HWLAdventureModeItems::get_name() 242 | { 243 | return this->s_name; 244 | } 245 | 246 | /** 247 | * Getter for the AM-Item-ID 248 | * 249 | * @return int the ID of the AM-Item 250 | * 251 | */ 252 | int HWLAdventureModeItems::get_id() 253 | { 254 | return this->i_id; 255 | } 256 | 257 | /** 258 | * Getter for the AM-Item-offset 259 | * 260 | * @return int the offset of the AM-Item 261 | * 262 | */ 263 | int HWLAdventureModeItems::get_offset() 264 | { 265 | return this->i_offset; 266 | } 267 | 268 | /** 269 | * Getter for the AM-Item-type 270 | * 271 | * @return int the type of the AM-Item 272 | * 273 | */ 274 | int HWLAdventureModeItems::get_map_id() 275 | { 276 | return this->i_map_id; 277 | } 278 | 279 | /** 280 | * Getter for the AM-Item-value 281 | * 282 | * @return int the value of the AM-Item 283 | * 284 | */ 285 | int HWLAdventureModeItems::get_value() 286 | { 287 | return this->i_value; 288 | } 289 | 290 | 291 | 292 | /** 293 | * This method returns an formatted string, which contain all needed member-values 294 | * 295 | * @return string formatted output with all needed member-values 296 | * 297 | */ 298 | string HWLAdventureModeItems::get_AMItemForOutput() 299 | { 300 | string s_output = "Name: " + this->s_name + "\n" 301 | //+ " ID: " + to_string(this->i_id) + "\n" 302 | //+ " Map-ID: " + to_string(this->i_map_id) + "\n" 303 | + " Value: " + to_string(this->i_value) + "\n"; 304 | //+ " Offset: " + to_string(this->i_offset) + "\n"; 305 | 306 | return s_output; 307 | } 308 | 309 | 310 | 311 | /** 312 | * This method is a wrapper for all known save-methods of the class 313 | * 314 | */ 315 | void HWLAdventureModeItems::save_AMItem() 316 | { 317 | this->save_value(); 318 | } 319 | -------------------------------------------------------------------------------- /source/core/HWLAdventureModeItems.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | #pragma once 5 | 6 | //include the parent-class 7 | #include "HWLSaveEditorCore.h" 8 | 9 | //add the class to the project-namespace 10 | namespace HWLSaveEdit 11 | { 12 | class HWLAdventureModeItems : public HWLSaveEditorCore 13 | { 14 | private: 15 | /* @var s_name name of the AM-Item */ 16 | string s_name; 17 | 18 | /* @var i_offset id of the AM-Item */ 19 | int i_id; 20 | 21 | /* @var i_offset offset of the AM-Item */ 22 | int i_offset; 23 | 24 | /* @var i_map_id map-id of the AM-Item */ 25 | int i_map_id; 26 | 27 | /* @var i_value value of the AM-Item */ 28 | int i_value; 29 | 30 | //needed private members/constans 31 | static const vector vs_amItems; 32 | 33 | //methods for calculation and saving the AM-Item-Value 34 | int calc_value(); 35 | void save_value(); 36 | 37 | 38 | 39 | public: 40 | //needed public members/constans 41 | static const int amItemValueMax; 42 | 43 | //constructor and destructor 44 | HWLAdventureModeItems(int i_id, int i_offset, int i_map_id); 45 | ~HWLAdventureModeItems(); 46 | 47 | //method(s) for setting 48 | void set_value(int i_value); 49 | 50 | //methods for getting the members 51 | string get_name(); 52 | int get_id(); 53 | int get_offset(); 54 | int get_map_id(); 55 | int get_value(); 56 | 57 | //method to get a formatted output (for console) 58 | string get_AMItemForOutput(); 59 | 60 | //saving method 61 | void save_AMItem(); 62 | 63 | }; 64 | 65 | } -------------------------------------------------------------------------------- /source/core/HWLAdventureModeMaps.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | //needed for including in a MFC-App 5 | #ifdef __MFC__ 6 | #include "../gui/stdafx.h" 7 | #endif // __MFC__ 8 | 9 | //include the correct header-file 10 | #include "HWLAdventureModeMaps.h" 11 | 12 | //use the project-namespace 13 | using namespace HWLSaveEdit; 14 | 15 | 16 | //private constants 17 | /* @var amItemOffsetBegin vector for holding the offsets-begin for AdventureMode items */ 18 | const vector HWLAdventureModeMaps::amItemOffsetBegin = 19 | { 20 | 0x2EFA, //Start of Adventure-Map Items 21 | 0xEB73, //Start of GreatSea-Map Items (WindWaker and so on) 22 | 0x7A52, //Start of MasterQuest-Map Items 23 | 0xA00A, //Start of Twilight-Map Items (Lantern and so on) 24 | 0xC5BE, //Start of Termina-Map Items (Song of Time and so on) 25 | 0x11120, //Start of MasterWindWaker-Map Items (Cannon and so on), only 1st DLC: Master Wind Waker DLC 26 | 0x136D5, //Start of KoholintIsland-Map Items (Full Moon Cello and so on), only 2nd DLC: Link's Awakening DLC 27 | 0x15C8D, //Start of GrandTravels-Map Items (Railway Track and so on), only 3rd DLC: Phantom Hourglass & Spirit Tracks DLC 28 | 0x18241, //Start of Lorule-Map Items (Wall Painting and so on), only 4th DLC: A Link Between Worlds DLC 29 | 30 | }; 31 | 32 | /* @var amItemOffsetBeginSpecial vector for holding the offsets-begin for AdventureMode items */ 33 | const vector HWLAdventureModeMaps::amItemOffsetBeginSpecial = 34 | { 35 | 0xEB56, //Compass of GreatSea-Map 36 | 0xEB5F, //Hookshot of GreatSea-Map 37 | 38 | 0x9FFE, //Compass of Twilight-Map (+1 = Bombs) 39 | 0xA003, //Waterbombs of Twilight-Map (+1 = Digging Mitts) 40 | 41 | 0xC5AA, //Compass of Termina-Map (+1 = Bombs) 42 | 0xC5B1, //Ice Arrow of Termina-Map 43 | 44 | //only 1st DLC: Master Wind Waker DLC 45 | 0x11102, //Compass of MasterWindWaker-Map 46 | 0x1110B, //Hookshot of MasterWindWaker-Map 47 | 0x1111F, //WindWaker of MasterWindWaker-Map 48 | 49 | //only 2nd DLC: Link's Awakening DLC 50 | 0x136AE, //Compass of KoholintIsland-Map 51 | 52 | //only 3rd DLC: Phantom Hourglass & Spirit Tracks DLC 53 | 0x15C5A, //Compass of GrandTravels-Map 54 | 0x15C8C, //Whirlwind of GrandTravels-Map 55 | 0x15C68, //Fishing Rod of GrandTravels-Map 56 | 0x15C78, //Cannon of GrandTravels-Map 57 | 58 | //only 4th DLC: A Link Between Worlds DLC 59 | 0x18207, //Bomb of Lorule-Map 60 | }; 61 | 62 | /* @var si_disabledMapCounter Counter which holds the current value of disabled AM-Maps */ 63 | int HWLAdventureModeMaps::si_disabledMapCounter = 0; 64 | 65 | 66 | //public constants 67 | 68 | /* @var vs_map_names vector, which hold all current names of all known AM-Maps */ 69 | const vector HWLAdventureModeMaps::vs_map_names = 70 | { 71 | "Adventure-Map", 72 | "GreatSea-Map", 73 | "MasterQuest-Map", 74 | "Twilight-Map", 75 | "Termina-Map", 76 | "MasterWindWaker-Map", //only 1st DLC: Master Wind Waker DLC 77 | "KoholintIsland-Map", //only 2nd DLC: Link's Awakening DLC 78 | "GrandTravels-Map", //only 3rd DLC: Phantom Hourglass & Spirit Tracks DLC 79 | "Lorule-Map", //only 4th DLC: A Link Between Worlds DLC 80 | }; 81 | 82 | /* @var amItemPerMapMax maximal-value of AdventureMode-Items per AM-Map */ 83 | const int HWLAdventureModeMaps::amm_MaxItemsPerMap = 12; 84 | 85 | 86 | 87 | /** 88 | * Only the initialization of the normal-constructor 89 | */ 90 | HWLAdventureModeMaps::HWLAdventureModeMaps(int i_id) 91 | { 92 | //Reset static values if new saveFile is opened 93 | if (this->b_isNewSaveFile) 94 | this->si_disabledMapCounter = 0; 95 | 96 | //set or calculate all needed members 97 | this->i_id = i_id; 98 | this->s_name = this->vs_map_names[this->i_id]; 99 | this->b_isDisabled = false; 100 | this->vsp_hwlami_items = this->calc_amiItems(); 101 | } 102 | 103 | 104 | /** 105 | * Only the initialization of the normal-destructor 106 | */ 107 | HWLAdventureModeMaps::~HWLAdventureModeMaps() 108 | { 109 | } 110 | 111 | 112 | 113 | /** 114 | * This method calculate the AdventureMode-Item-Objects 115 | * 116 | */ 117 | vector> HWLAdventureModeMaps::calc_amiItems() 118 | { 119 | //decalre/define needed variables 120 | int i_offset; 121 | vector> vsp_hwlami_items_tmp; 122 | 123 | //Iterate over the current correct Items of the map 124 | for (int i = (this->i_id * this->amm_MaxItemsPerMap); i < (this->i_id * this->amm_MaxItemsPerMap) + this->amm_MaxItemsPerMap; i++) 125 | { 126 | 127 | //switch of iterate-variable i, cause we have to check some special AdventureMode Items, they are called 128 | //"shared-items" like Compass,...that we found on nearly every AdventureMode-Map. They have special-offsets then 129 | //Else: Get the normal offset of the Item 130 | switch (i) 131 | { 132 | //BEGIN SPECIAL ITEMS-OFFSETS 133 | case 12: //Compass, Great-Sea Map 134 | i_offset = this->amItemOffsetBeginSpecial[0]; 135 | break; 136 | 137 | case 13: //Hookshot, Great-Sea Map 138 | i_offset = this->amItemOffsetBeginSpecial[1]; 139 | break; 140 | 141 | case 36: //Compass, Twilight Map 142 | i_offset = this->amItemOffsetBeginSpecial[2]; 143 | break; 144 | 145 | case 38: //Water Bombs, Twilight Map 146 | i_offset = this->amItemOffsetBeginSpecial[3]; 147 | break; 148 | 149 | case 48: //Compass, Termina Map 150 | i_offset = this->amItemOffsetBeginSpecial[4]; 151 | break; 152 | 153 | case 50: //Ice Arrow, Termina Map 154 | i_offset = this->amItemOffsetBeginSpecial[5]; 155 | break; 156 | 157 | case 60: //Compass, MasterWindWaker Map, only 1st DLC: Master Wind Waker DLC 158 | i_offset = this->amItemOffsetBeginSpecial[6]; 159 | break; 160 | 161 | case 61: //Hookshot, MasterWindWaker Map, only 1st DLC: Master Wind Waker DLC 162 | i_offset = this->amItemOffsetBeginSpecial[7]; 163 | break; 164 | 165 | case 62: //Wind Waker, MasterWindWaker Map, only 1st DLC: Master Wind Waker DLC 166 | i_offset = this->amItemOffsetBeginSpecial[8]; 167 | break; 168 | 169 | case 72: //Compass, KoholintIsland Map, only 2nd DLC: Link's Awakening DLC 170 | i_offset = this->amItemOffsetBeginSpecial[9]; 171 | break; 172 | 173 | case 84: //Compass, GrandTravels Map, only 3rd DLC: Phantom Hourglass & Spirit Tracks DLC 174 | i_offset = this->amItemOffsetBeginSpecial[10]; 175 | break; 176 | 177 | case 85: //Whirlwind, GrandTravels Map, only 3rd DLC: Phantom Hourglass & Spirit Tracks DLC 178 | i_offset = this->amItemOffsetBeginSpecial[11]; 179 | break; 180 | 181 | case 86: //Fishing Rod, GrandTravels Map, only 3rd DLC: Phantom Hourglass & Spirit Tracks DLC 182 | i_offset = this->amItemOffsetBeginSpecial[12]; 183 | break; 184 | 185 | case 87: //Cannon, GrandTravels Map, only 3rd DLC: Phantom Hourglass & Spirit Tracks DLC 186 | i_offset = this->amItemOffsetBeginSpecial[13]; 187 | break; 188 | 189 | case 96: //Bombs, Lorule Map, only 4th DLC: A Link Between Worlds DLC 190 | i_offset = this->amItemOffsetBeginSpecial[14]; 191 | break; 192 | 193 | //END SPECIAL ITEMS-OFFSETS 194 | 195 | //BEGIN NORMAL ITEMS-OFFSETS 196 | case 0: //Compass, Adventure-Map 197 | case 14: //Wind Waker, Great-Sea Map 198 | case 24: //Compass, MasterQuest-Map 199 | case 40: //Lantern, Twilight Map 200 | case 51: //Song of Time, Termina Map 201 | case 63: //Cannon, MasterWindWaker Map, only 1st DLC: Master Wind Waker DLC 202 | case 73: //Full Moon Cello, KoholintIsland Map, only 2nd DLC: Link's Awakening DLC 203 | case 88: //Railway Track, GrandTravels Map, only 3rd DLC: Phantom Hourglass & Spirit Tracks DLC 204 | case 97: //Wall Painting, Lorule Map, only 4th DLC: A Link Between Worlds DLC 205 | i_offset = this->amItemOffsetBegin[this->i_id]; 206 | break; 207 | 208 | default: //normal, calculate the next offset 209 | i_offset = i_offset + this->amItemOffsetLength; 210 | break; 211 | //END NORMAL ITEMS-OFFSETS 212 | } 213 | 214 | //create new AdventureMode-item object, based on offset and type (also name) 215 | shared_ptr hwlami_tmp = make_shared(i, i_offset, this->i_id); 216 | 217 | //bind object to the map of them 218 | vsp_hwlami_items_tmp.push_back(hwlami_tmp); 219 | 220 | //calculate the next offset 221 | //i_offset = i_offset + this->amItemOffsetLength; 222 | } 223 | 224 | return vsp_hwlami_items_tmp; 225 | 226 | 227 | } 228 | 229 | 230 | 231 | /** 232 | * Setter for the AM-Map Disabled-State (and increment/decrement Counter-Member) 233 | * 234 | * @var bool b_isDisabled Disabled-State to set 235 | * 236 | */ 237 | void HWLAdventureModeMaps::set_isDisabled(bool b_isDisabled) 238 | { 239 | if (b_isDisabled) 240 | this->si_disabledMapCounter++; 241 | else if (this->si_disabledMapCounter > 0) 242 | this->si_disabledMapCounter--; 243 | 244 | this->b_isDisabled = b_isDisabled; 245 | } 246 | 247 | /** 248 | * Setter for the AM-Map Item, explicit by a given item-id and 249 | * a correct object 250 | * 251 | * @var int i_item_id given Item-ID to set (=vector-index) (0-11) 252 | * @var shared_ptr sp_hwlami_item shared-pointer (object) to set on given item-id / slot 253 | * 254 | */ 255 | void HWLAdventureModeMaps::set_amItem(int i_item_id, shared_ptr sp_hwlami_item) 256 | { 257 | if (i_item_id < this->amm_MaxItemsPerMap) 258 | this->vsp_hwlami_items[i_item_id] = sp_hwlami_item; 259 | } 260 | 261 | /** 262 | * Setter for the AM-Map Item-Vector itself (all items) 263 | * 264 | * @var vector> vsp_hwlami_item vector, which holds al items of that map 265 | * 266 | */ 267 | void HWLAdventureModeMaps::set_all_amItems(vector> vsp_hwlami_item) 268 | { 269 | this->vsp_hwlami_items = vsp_hwlami_item; 270 | } 271 | 272 | 273 | 274 | /** 275 | * Getter for the AM-Map-ID 276 | * 277 | * @return int the ID of the AM-Map 278 | * 279 | */ 280 | int HWLAdventureModeMaps::get_id() 281 | { 282 | return this->i_id; 283 | } 284 | 285 | /** 286 | * Getter for the AM-Map-Name 287 | * 288 | * @return string the Name of the AM-Map 289 | * 290 | */ 291 | string HWLAdventureModeMaps::get_name() 292 | { 293 | return this->s_name; 294 | } 295 | 296 | /** 297 | * Getter for the AM-Map Disabled-State 298 | * 299 | * @return bool the Disabled-State of the AM-Map 300 | * 301 | */ 302 | bool HWLAdventureModeMaps::get_isDisabled() 303 | { 304 | return this->b_isDisabled; 305 | } 306 | 307 | /** 308 | * Getter for the AM-Map Item, explicit by a given item-id 309 | * 310 | * @var int i_item_id given Item-ID to get (=vector-index) (0-11) 311 | * 312 | * @return shared_ptr shared-pointer (object) to get on given item-id / slot 313 | * 314 | */ 315 | shared_ptr HWLAdventureModeMaps::get_amItem(int i_item_id) 316 | { 317 | return this->vsp_hwlami_items[i_item_id]; 318 | } 319 | 320 | /** 321 | * Getter for the all AM-Map Items 322 | * 323 | * @return vector> vector of all AM-items of that map 324 | * 325 | */ 326 | vector> HWLAdventureModeMaps::get_all_amItems() 327 | { 328 | return this->vsp_hwlami_items; 329 | } 330 | 331 | /** 332 | * Getter for the disbaledMapCounter 333 | * 334 | * @return int the disabled-MapCounter 335 | * 336 | */ 337 | int HWLAdventureModeMaps::get_disabledMapCounter() 338 | { 339 | return si_disabledMapCounter; 340 | } 341 | 342 | 343 | 344 | /** 345 | * This method returns an formatted string, which contain all Output 346 | * of the AM-items of the current map 347 | * 348 | * @return string formatted output with all needed information 349 | * 350 | */ 351 | string HWLAdventureModeMaps::get_AllAMItemsForOutput() 352 | { 353 | string s_output = "\n "; 354 | 355 | for (int i = 0; i < this->amm_MaxItemsPerMap; i++) 356 | { 357 | s_output = s_output + this->vsp_hwlami_items[i]->get_AMItemForOutput() + "\n "; 358 | } 359 | 360 | return s_output; 361 | } 362 | 363 | /** 364 | * This method returns an formatted string, which contain all needed member-values 365 | * 366 | * @var bool b_with_item_output TRUE: show output of items, FALSE: not 367 | * 368 | * @return string formatted output with all needed member-values 369 | * 370 | */ 371 | string HWLAdventureModeMaps::get_AMMapForOutput(bool b_with_item_output) 372 | { 373 | string s_output = ""; 374 | 375 | if (b_with_item_output) 376 | { 377 | s_output = s_output + "Map-ID: " + to_string(this->i_id) + " | Name: " + this->s_name + "\n" 378 | + "Items: \n" + this->get_AllAMItemsForOutput() + "\n"; 379 | } 380 | else 381 | { 382 | s_output = s_output + "Map-ID: " + to_string(this->i_id) + " | Name: " + this->s_name + "\n"; 383 | } 384 | 385 | return s_output; 386 | } -------------------------------------------------------------------------------- /source/core/HWLAdventureModeMaps.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | #pragma once 5 | 6 | //include the parent-class 7 | #include "HWLSaveEditorCore.h" 8 | #include "HWLAdventureModeItems.h" 9 | 10 | //add the class to the project-namespace 11 | namespace HWLSaveEdit 12 | { 13 | class HWLAdventureModeMaps : public HWLSaveEditorCore 14 | { 15 | private: 16 | /* @var i_id ID of the AM-Map */ 17 | int i_id; 18 | 19 | /* @var s_name name of the AM-Map */ 20 | string s_name; 21 | 22 | /* @var b_isDisabled state, if map is complety disabled (not editable) */ 23 | bool b_isDisabled; 24 | 25 | /* @var vsp_ami_items vector to hold the current items (of current map) as coressponding object */ 26 | vector> vsp_hwlami_items; 27 | 28 | //needed private static members/constans 29 | static const vector amItemOffsetBegin; 30 | static const vector amItemOffsetBeginSpecial; 31 | static int si_disabledMapCounter; 32 | 33 | //methods for calculation of the AM-Map-Items 34 | vector> calc_amiItems(); 35 | 36 | public: 37 | //needed public members/constans 38 | static const vector vs_map_names; 39 | static const int amm_MaxItemsPerMap; 40 | 41 | //constructor and destructor 42 | HWLAdventureModeMaps(int i_id); 43 | ~HWLAdventureModeMaps(); 44 | 45 | //method(s) for setting 46 | void set_isDisabled(bool b_isDisabled); 47 | void set_amItem(int i_item_id, shared_ptr sp_hwlami_item); 48 | void set_all_amItems(vector> vsp_hwlami_item); 49 | 50 | //methods for getting the members 51 | int get_id(); 52 | string get_name(); 53 | bool get_isDisabled(); 54 | shared_ptr get_amItem(int i_item_id); 55 | vector> get_all_amItems(); 56 | static int get_disabledMapCounter(); 57 | 58 | //method to get a formatted output (for console) 59 | string get_AllAMItemsForOutput(); 60 | string get_AMMapForOutput(bool b_with_item_output=true); 61 | }; 62 | 63 | } -------------------------------------------------------------------------------- /source/core/HWLConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | #pragma once 5 | #include //needed for compiling with gcc 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include //needed for sort-function 11 | #include "HWLException.h" 12 | 13 | //add the class to the project-namespace 14 | namespace HWLSaveEdit 15 | { 16 | using namespace std; 17 | 18 | class HWLConfig 19 | { 20 | private: 21 | /* @struct st_config structure for holding needed param-data */ 22 | struct st_config { 23 | string s_name; //param-name 24 | string s_section; //param-section 25 | int i_id; //param-id (zero-based to each section) 26 | bool b_isBool; //is this param a boolean one 27 | bool b_value; //boolean value of param 28 | string s_value; //string value of param 29 | }; 30 | 31 | /* @var m_config_values hold all config-params of each section */ 32 | map< string, map< string, st_config> > m_config_values; 33 | 34 | //needed private members/constans 35 | static const string configFileName; 36 | static const vector vs_config_section_names; 37 | static const vector vs_config_param_names; 38 | static const vector vs_config_param_default_values; 39 | 40 | //getter/setter for the complete structure of an parameter 41 | st_config get_current_config_object(string s_param_name, int i_section_id); 42 | st_config get_current_config_object(string s_param_name, string s_section_name); 43 | void set_current_config_object(string s_param_name, int i_section_id, st_config stc_config_values); 44 | void set_current_config_object(string s_param_name, string s_section_name, st_config stc_config_values); 45 | 46 | //method to get an internal-ordered list of all params of an section (sort by i_id) 47 | vector< pair< string, st_config> > get_ordered_section_params(string s_section_name); 48 | 49 | public: 50 | //constructor and destructor 51 | HWLConfig(bool b_read_current_config = true); 52 | ~HWLConfig(); 53 | 54 | //method to get/calculate the hardcoded default-values 55 | void calculate_config_defaults(); 56 | 57 | //method for read/write the configfile 58 | void read_config(); 59 | void write_config(bool b_default_config = false); 60 | 61 | //method to get the section-id of given name 62 | int get_sectionID(string s_section_name); 63 | 64 | //check, getter/setter of an parameter 65 | bool check_if_param_exist(string s_param_name, int i_section_id); 66 | int get_param_id(string s_param_name, int i_section_id); 67 | string get_param_value(string s_param_name, int i_section_id); 68 | bool get_param_isBool(string s_param_name, int i_section_id); 69 | void set_param_value(string s_param_name, int i_section_id, string s_param_value); 70 | void set_param_value(string s_param_name, int i_section_id, bool b_param_value); 71 | 72 | //method to get a formatted output (for console) 73 | string get_ConfigForOutput(); 74 | }; 75 | 76 | 77 | } 78 | -------------------------------------------------------------------------------- /source/core/HWLException.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | //needed for including in a MFC-App 5 | #ifdef __MFC__ 6 | #include "../gui/stdafx.h" 7 | #endif // __MFC__ 8 | 9 | //include the correct header-file 10 | #include "HWLException.h" 11 | 12 | //use the project-namespace 13 | using namespace HWLSaveEdit; 14 | 15 | /** 16 | * Only the initialization of the normal-constructor, 17 | * set the code and message 18 | * 19 | */ 20 | HWLException::HWLException(const char* const& c_desc, int i_code) 21 | { 22 | this->c_desc = c_desc; 23 | this->i_error_code = i_code; 24 | } 25 | 26 | /** 27 | * Only the initialization of the normal-destructor 28 | */ 29 | HWLException::~HWLException() 30 | { 31 | } 32 | 33 | /** 34 | * This method return the current error-message 35 | * 36 | */ 37 | const char *HWLException::what() 38 | { 39 | return this->c_desc; 40 | } 41 | 42 | /** 43 | * This method return the current error-code 44 | * 45 | */ 46 | int HWLException::get_code() 47 | { 48 | return this->i_error_code; 49 | } -------------------------------------------------------------------------------- /source/core/HWLException.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | #pragma once 5 | #include 6 | 7 | //add the class to the project-namespace 8 | namespace HWLSaveEdit 9 | { 10 | using namespace std; 11 | 12 | //extend the standard-exception 13 | class HWLException : public exception 14 | { 15 | private: 16 | /* @var int i_error_code the current error-code */ 17 | int i_error_code; 18 | 19 | /* @var char* c_desc the description/message of the current error */ 20 | const char* c_desc; 21 | 22 | public: 23 | HWLException(const char* const& c_desc, int i_code); 24 | ~HWLException(); 25 | 26 | //extend/overwrite the standard methods 27 | virtual const char* what(); 28 | int get_code(); 29 | }; 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /source/core/HWLFairy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | #pragma once 5 | 6 | //include the parent-class 7 | #include "HWLSaveEditorCore.h" 8 | 9 | //add the class to the project-namespace 10 | namespace HWLSaveEdit 11 | { 12 | //extend our Core-Class 13 | class HWLFairy : public HWLSaveEditorCore 14 | { 15 | private: 16 | /* @var s_name name of the fairy */ 17 | string s_name; 18 | 19 | /* @var i_offset offset of the fairy */ 20 | int i_offset; 21 | 22 | /* @var i_lvl lvl of the fairy */ 23 | int i_lvl; 24 | 25 | /* @var i_trust trust of the fairy */ 26 | int i_trust; 27 | 28 | /* @var i_iterator iterations/refreshes of the fairy */ 29 | int i_iterator; 30 | 31 | /* @var b_isUnlock unlock-state of the fairy */ 32 | bool b_isUnlock; 33 | 34 | //offset-const declaration 35 | static const int fairyNameOffsetLength; 36 | static const int fairyLVLOffsetLength; 37 | static const int fairyTrustOffsetLength; 38 | static const int fairyIteratorOffsetLength; 39 | static const int fairyIsUnlockOffsetLength; 40 | 41 | static const int fairyNameOffsetDiff; 42 | static const int fairyLVLOffsetDiff; 43 | static const int fairyTrustOffsetDiff; 44 | static const int fairyIteratorOffsetDiff; 45 | static const int fairyIsUnlockOffsetDiff; 46 | 47 | //methods for calculation of all (known) stati-values of a fairy 48 | string calc_fairy_name(); 49 | int calc_fairy_lvl(); 50 | int calc_fairy_trust(); 51 | int calc_fairy_iterator(); 52 | bool calc_fairy_isUnlockState(); 53 | 54 | //methods for saving all current stati-values of a fairy 55 | void save_fairy_name(); 56 | void save_fairy_lvl(); 57 | void save_fairy_trust(); 58 | void save_fairy_iterator(); 59 | void save_fairy_isUnlockState(); 60 | 61 | public: 62 | //needed public members/constans 63 | static const int fairyNameLength; 64 | static const int fairyLVLMax; 65 | static const int fairyTrustMax; 66 | static const int fairyIteratorMax; 67 | 68 | //constructor and destructor 69 | HWLFairy(int i_offset); 70 | ~HWLFairy(); 71 | 72 | //methods to set and get all stati-values of a fairy 73 | void set_name(string s_name); 74 | void set_lvl(int i_lvl); 75 | void set_trust(int i_trust); 76 | void set_iterator(int i_iterator); 77 | void set_isUnlock(bool b_isUnlock); 78 | 79 | string get_name(); 80 | int get_offset(); 81 | int get_lvl(); 82 | int get_trust(); 83 | int get_iterator(); 84 | bool get_isUnlock(); 85 | 86 | //method to get a formatted output (for console) 87 | string get_fairyForOutput(); 88 | 89 | //saving method 90 | void save_Fairy(); 91 | }; 92 | 93 | } -------------------------------------------------------------------------------- /source/core/HWLFairyFood.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | //needed for including in a MFC-App 5 | #ifdef __MFC__ 6 | #include "../gui/stdafx.h" 7 | #endif // __MFC__ 8 | 9 | //include the correct header-file 10 | #include "HWLFairyFood.h" 11 | 12 | //use the project-namespace 13 | using namespace HWLSaveEdit; 14 | 15 | /* @var vs_fairyFood vector for holding all names of fairyFood-Items */ 16 | const vector HWLFairyFood::vs_fairyFood = 17 | { 18 | "Weird Egg", 19 | "Tasty Weird Egg", 20 | "Delicious Weird Egg", 21 | "Lon Lon Milk", 22 | "Tasty Lon Lon Milk", 23 | "Delicious Lon Lon Milk", 24 | "Odd Mushroom", 25 | "Tasty Odd Mushroom", 26 | "Delicious Odd Mushroom", 27 | "Deku Nut", 28 | "Tasty Deku Nut", 29 | "Delicious Deku Nut", 30 | "Magic Beans", 31 | "Tasty Magic Beans", 32 | "Delicious Magic Beans", 33 | "Pumpkin Soup", 34 | "Tasty Pumpkin Soup", 35 | "Delicious Pumpkin Soup", 36 | "Sacred Water", 37 | "Tasty Sacred Water", 38 | "Delicious Sacred Water", 39 | "Life Tree Fruit", 40 | "Tasty Life Tree Fruit", 41 | "Delicious Life Tree Fruit", 42 | "Light Fruit", 43 | "Tasty Light Fruit", 44 | "Delicious Light Fruit", 45 | "Stamina Fruit", 46 | "Tasty Stamina Fruit", 47 | "Delicious Stamina Fruit", 48 | "Water Fruit", 49 | "Tasty Water Fruit", 50 | "Delicious Water Fruit", 51 | "Mushroom Spores", 52 | "Tasty Mushroom Spores", 53 | "Delicious Mushroom Spores", 54 | "All-Purpose Bait", 55 | "Tasty All-Purpose Bait", 56 | "Delicious All-Purpose Bait", 57 | "Elixir Soup", 58 | "Tasty Elixir Soup", 59 | "Delicious Elixir Soup", 60 | "Hyoi Pear", 61 | "Tasty Hyoi Pear", 62 | "Delicious Hyoi Pear", 63 | "Ordon Goat Cheese", 64 | "Tasty Ordon Goat Cheese", 65 | "Delicious Ordon Goat Cheese", 66 | "Great Fairy's Tears", 67 | "Tasty Great Fairy's Tears", 68 | "Delicious Great Fairy's Tears", 69 | "Greengill", 70 | "Tasty Greengill", 71 | "Delicious Greengill", 72 | "Ordon Catfish", 73 | "Tasty Ordon Catfish", 74 | "Delicious Ordon Catfish", 75 | "Hyrule Bass", 76 | "Tasty Hyrule Bass", 77 | "Delicious Hyrule Bass", 78 | "Hylian Pike", 79 | "Tasty Hylian Pike", 80 | "Delicious Hylian Pike", 81 | "Reekfish", 82 | "Tasty Reekfish", 83 | "Delicious Reekfish", 84 | "Hylian Loach", 85 | "Tasty Hylian Loach", 86 | "Delicious Hylian Loach", 87 | "Skullfish", 88 | "Tasty Skullfish", 89 | "Delicious Skullfish", 90 | "Bombfish", 91 | "Tasty Bombfish", 92 | "Delicious Bombfish", 93 | "Chu Jelly", 94 | "Tasty Chu Jelly", 95 | "Delicious Chu Jelly", 96 | "Bee Larvae", 97 | "Tasty Bee Larvae", 98 | "Delicious Bee Larvae", 99 | "Chateau Romani", 100 | "Tasty Chateau Romani", 101 | "Delicious Chateau Romani", 102 | "Bottled Water", 103 | "Tasty Bottled Water", 104 | "Delicious Bottled Water", 105 | "Hot Spring Water", 106 | "Tasty Hot Spring Water", 107 | "Delicious Hot Spring Water", 108 | "Rock Sirloin", 109 | "Tasty Rock Sirloin", 110 | "Delicious Rock Sirloin", 111 | "Meat", 112 | "Tasty Meat", 113 | "Delicious Meat", 114 | "Carrot", 115 | "Tasty Carrot", 116 | "Delicious Carrot", 117 | "Ember Seeds", 118 | "Tasty Ember Seeds", 119 | "Delicious Ember Seeds", 120 | "Scent Seeds", 121 | "Tasty Scent Seeds", 122 | "Delicious Scent Seeds", 123 | "Pegasus Seeds", 124 | "Tasty Pegasus Seeds", 125 | "Delicious Pegasus Seeds", 126 | "Gale Seeds", 127 | "Tasty Gale Seeds", 128 | "Delicious Gale Seeds", 129 | "Mystery Seeds", 130 | "Tasty Mystery Seeds", 131 | "Delicious Mystery Seeds", 132 | "Gratitude Crystal Red S", 133 | "Gratitude Crystal Red M", 134 | "Gratitude Crystal Red L", 135 | "Gratitude Crystal Blue S", 136 | "Gratitude Crystal Blue M", 137 | "Gratitude Crystal Blue L", 138 | "Gratitude Crystal Orange S", 139 | "Gratitude Crystal Orange M", 140 | "Gratitude Crystal Orange L", 141 | "Gratitude Crystal Pink S", 142 | "Gratitude Crystal Pink M", 143 | "Gratitude Crystal Pink L", 144 | "Gratitude Crystal Purple S", 145 | "Gratitude Crystal Purple M", 146 | "Gratitude Crystal Purple L", 147 | "Pumpkin", 148 | "Tasty Pumpkin", 149 | "Delicious Pumpkin" 150 | }; 151 | 152 | /* @var fairyFoodlValueMax maximal-value of a fairyFood item*/ 153 | const int HWLFairyFood::fairyFoodlValueMax = 255; 154 | 155 | /* @var fairyGratitudeCrystalIDBegin ÌD of the first gratitude crystal */ 156 | const int HWLFairyFood::fairyGratitudeCrystalIDBegin = 114; 157 | 158 | /* @var fairyGratitudeCrystalIDEnd ÌD of the last gratitude crystal */ 159 | const int HWLFairyFood::fairyGratitudeCrystalIDEnd = 128; 160 | 161 | 162 | 163 | /** 164 | * Only the initialization of the normal-constructor 165 | */ 166 | HWLFairyFood::HWLFairyFood(string s_name, int i_offset) 167 | { 168 | //set or calculate all needed members 169 | this->s_name = s_name; 170 | this->i_offset = i_offset; 171 | this->i_value = this->calc_value(); 172 | } 173 | 174 | /** 175 | * Only the initialization of the normal-destructor 176 | */ 177 | HWLFairyFood::~HWLFairyFood() 178 | { 179 | } 180 | 181 | 182 | 183 | /** 184 | * This method calculates the current fairyFood value 185 | * 186 | * @return int the current fairyFood-value 187 | * 188 | */ 189 | int HWLFairyFood::calc_value() 190 | { 191 | //declare/define needed variables 192 | string s_fairyFood_value; 193 | int i_fairyFood_offset = this->i_offset; 194 | 195 | //get hex-value from the file-content holder and convert it to int 196 | s_fairyFood_value = this->getHexStringFromFileContent(i_fairyFood_offset, this->fairyFoodOffsetLength); 197 | int i_fairyFood_value = this->HexStringToInt(s_fairyFood_value); 198 | 199 | //return the current int-value 200 | return i_fairyFood_value; 201 | } 202 | 203 | /** 204 | * This method set the current fairyFood-value 205 | * to the file-content holder 206 | * 207 | */ 208 | void HWLFairyFood::save_value() 209 | { 210 | //declare/define needed variables 211 | int i_value_tmp = this->i_value; 212 | string s_fairyFood_value; 213 | int i_fairyFood_offset = this->i_offset; 214 | 215 | //convert the current integer-value to hex and add needed zeros, if we 216 | //don't have the complete length (calculate with offset-length multiplied by 2) 217 | s_fairyFood_value = this->intToHexString(i_value_tmp, false); 218 | this->addZeroToHexString(s_fairyFood_value, this->fairyFoodOffsetLength * 2); 219 | 220 | //set converted hex-value to the file-content holder 221 | this->setHexStringToFileContent(s_fairyFood_value, i_fairyFood_offset); 222 | } 223 | 224 | 225 | 226 | /** 227 | * Setter for the fairyFood-value 228 | * 229 | * @var int i_value fairyFood-value to set 230 | * 231 | */ 232 | void HWLFairyFood::set_value(int i_value) 233 | { 234 | //check if fairyFood-value smaller then 0, then set it directly to 0 235 | //also check for the maximal-value 236 | if (i_value < 0) 237 | i_value = 0; 238 | else if (i_value > this->fairyFoodlValueMax) 239 | i_value = this->fairyFoodlValueMax; 240 | 241 | this->i_value = i_value; 242 | } 243 | 244 | 245 | 246 | /** 247 | * Getter for the fairyFood-name 248 | * 249 | * @return string the name of the fairyFood 250 | * 251 | */ 252 | string HWLFairyFood::get_name() 253 | { 254 | return this->s_name; 255 | } 256 | 257 | /** 258 | * Getter for the fairyFood-offset 259 | * 260 | * @return int the offset of the fairyFood 261 | * 262 | */ 263 | int HWLFairyFood::get_offset() 264 | { 265 | return this->i_offset; 266 | } 267 | 268 | /** 269 | * Getter for the fairyFood-value 270 | * 271 | * @return int the value of the fairyFood 272 | * 273 | */ 274 | int HWLFairyFood::get_value() 275 | { 276 | return this->i_value; 277 | } 278 | 279 | 280 | 281 | /** 282 | * This method returns an formatted string, which contain all needed member-values 283 | * 284 | * @return string formatted output with all needed member-values 285 | * 286 | */ 287 | string HWLFairyFood::get_FairyFoodForOutput() 288 | { 289 | string s_output = "Name: " + this->s_name + "\n" 290 | + " Value: " + to_string(this->i_value) + "\n"; 291 | 292 | return s_output; 293 | } 294 | 295 | /** 296 | * This method is a wrapper for all known save-methods of the class 297 | * 298 | */ 299 | void HWLFairyFood::save_FairyFood() 300 | { 301 | this->save_value(); 302 | } 303 | -------------------------------------------------------------------------------- /source/core/HWLFairyFood.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | #pragma once 5 | 6 | //include the parent-class 7 | #include "HWLSaveEditorCore.h" 8 | 9 | //add the class to the project-namespace 10 | namespace HWLSaveEdit 11 | { 12 | //extend our Core-Class 13 | class HWLFairyFood : public HWLSaveEditorCore 14 | { 15 | private: 16 | /* @var s_name name of the fairyFood */ 17 | string s_name; 18 | 19 | /* @var i_offset offset of the fairyFood */ 20 | int i_offset; 21 | 22 | /* @var i_value value of the fairyFood */ 23 | int i_value; 24 | 25 | //methods for calculation and saving the fairyFoods 26 | int calc_value(); 27 | void save_value(); 28 | 29 | public: 30 | //needed public members/constans 31 | static const vector vs_fairyFood; 32 | static const int fairyFoodlValueMax; 33 | static const int fairyGratitudeCrystalIDBegin; 34 | static const int fairyGratitudeCrystalIDEnd; 35 | 36 | //constructor and destructor 37 | HWLFairyFood(string s_name, int i_offset); 38 | ~HWLFairyFood(); 39 | 40 | //method(s) for setting 41 | void set_value(int i_value); 42 | 43 | //methods for getting the members 44 | string get_name(); 45 | int get_offset(); 46 | int get_value(); 47 | 48 | //method to get a formatted output (for console) 49 | string get_FairyFoodForOutput(); 50 | 51 | //saving method 52 | void save_FairyFood(); 53 | }; 54 | 55 | } -------------------------------------------------------------------------------- /source/core/HWLGeneral.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | #pragma once 5 | 6 | //include the parent-class 7 | #include "HWLSaveEditorCore.h" 8 | 9 | //add the class to the project-namespace 10 | namespace HWLSaveEdit 11 | { 12 | //extend our Core-Class 13 | class HWLGeneral : public HWLSaveEditorCore 14 | { 15 | private: 16 | /* @var i_rubies hold the rubies-value */ 17 | int i_rubies = 0; 18 | 19 | /* @var b_unlocked_smithy state, if ingame smithy is unlocked */ 20 | bool b_unlocked_smithy = false; 21 | 22 | /* @var b_unlocked_all_normal_weapons state, if all normal-weapons are found (MW-Skill 1)*/ 23 | bool b_unlocked_all_normal_weapons = false; 24 | 25 | /* @var b_unlocked_all_plus_weapons state, if all plus-weapons are found (MW-Skill 2)*/ 26 | bool b_unlocked_all_plus_weapons = false; 27 | 28 | /* @var b_unlocked_all_materials state, if all materials where found */ 29 | bool b_unlocked_all_materials = false; 30 | 31 | //offset-const declaration 32 | static const int rubyOffset; 33 | static const int rubyOffsetLength; 34 | 35 | static const int unlockIngameSmithyOffset; 36 | static const int unlockIngameSmithyOffsetLength; 37 | static const int unlockIngameSmithyOffsetPart; 38 | 39 | static const int unlockAllNormalWeaponsOffset; 40 | static const int unlockAllNormalWeaponsOffsetLength; 41 | 42 | static const int unlockAllPlusWeaponsOffset; 43 | static const int unlockAllPlusWeaponsOffsetLength; 44 | static const int unlockAllPlusWeaponsOffsetPart; 45 | 46 | static const vector unlockAllMaterialsOffsets; 47 | static const int unlockAllMaterialsOffsetsLength; 48 | 49 | static const int unlockIngameSmithyValue; 50 | static const int unlockAllPlusWeaponsValue; 51 | static const int unlockAllPlusWeaponsValueMin; 52 | 53 | static const unsigned int unlockAllMaterialsMinValue; 54 | static const unsigned int unlockAllMaterialsMaxValue; 55 | static const int unlockAllMaterialsMinValueLastOffset; 56 | static const int unlockAllMaterialsMaxValueLastOffset; 57 | 58 | static const int savefileGameVersionOffset; 59 | static const int savefileGameVersionOffsetLength; 60 | static const int savefileGameVersionOffsetPart; 61 | static const vector vs_game_version_strings; 62 | 63 | static const vector vi_game_dlc_identifier_offsets_begin; 64 | static const vector vi_game_dlc_identifier_offsets_end; 65 | static const vector vs_game_dlc_default_hexStrings; 66 | static const vector vs_game_dlc_strings; 67 | 68 | //methods for calculation of all (known) general-things 69 | string calc_current_savefile_game_version(); 70 | vector calc_installed_dlcs(); 71 | int calc_rubies(); 72 | bool calc_unlocked_smithy_state(); 73 | bool calc_unlocked_normal_weapons_state(); 74 | bool calc_unlocked_plus_weapons_state(); 75 | bool calc_unlock_all_materials_state(); 76 | 77 | //methods for saving all (known) general-things 78 | void save_rubies(); 79 | void save_unlocked_smithy_state(); 80 | void save_unlocked_normal_weapons_state(); 81 | void save_unlocked_plus_weapons_state(); 82 | void save_unlock_all_materials_state(); 83 | 84 | public: 85 | //needed public members/constants 86 | static const int rubyMax; 87 | static const int fairiesMax; 88 | 89 | //constructor and destructor 90 | HWLGeneral(); 91 | ~HWLGeneral(); 92 | 93 | //methods to set and get all (known) general-things 94 | string get_current_savefile_game_version(); 95 | int get_dlc_max_available_dlcs(); 96 | int get_dlc_installed_dlcs_value(); 97 | bool get_dlc_installed_state(int i_dlc_id); 98 | string get_dlc_name(int i_dlc_id); 99 | int get_rubies(); 100 | bool get_unlocked_smithy_state(); 101 | bool get_unlocked_normal_weapons_state(); 102 | bool get_unlocked_plus_weapons_state(); 103 | bool get_unlocked_all_materials_state(); 104 | 105 | void set_rubies(int i_rubies); 106 | void set_unlocked_smithy_state(bool b_unlocked_smithy); 107 | void set_unlocked_normal_weapons_state(bool b_unlocked_all_normal_weapons); 108 | void set_unlocked_plus_weapons_state(bool b_unlocked_all_plus_weapons); 109 | void set_unlocked_all_materials_state(bool b_unlocked_all_materials); 110 | 111 | //method to get a formatted output (for console) 112 | string get_DLCsForOutput(); 113 | string get_GeneralThingsForOutput(); 114 | 115 | //saving method 116 | void save_General(); 117 | }; 118 | 119 | } -------------------------------------------------------------------------------- /source/core/HWLHttp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | //include the correct header-file 5 | #include "HWLHttp.h" 6 | 7 | //use the project-namespace 8 | using namespace HWLSaveEdit; 9 | 10 | /* @var o_http_client object for the http-client lib */ 11 | HTTP_Client HWLHttp::o_http_client = HTTP_Client(); 12 | 13 | /* @var maxVersionLength max length of a version-string (for comparison) */ 14 | const int HWLHttp::maxVersionLength = 10; 15 | 16 | 17 | /* @var nightlyURL url of the nightly-server, user defined */ 18 | const string HWLHttp::nightlyURL = NIGHTLY_URL; 19 | 20 | /* @var latestURL url of the latest stable release */ 21 | const string HWLHttp::latestURL = "https://github.com/nedron92/HWL-SaveEditor/releases/latest"; 22 | 23 | 24 | /** 25 | * Only the initialization of the normal-constructor 26 | */ 27 | HWLHttp::HWLHttp() 28 | { 29 | } 30 | 31 | /** 32 | * Only the initialization of the normal-destructor 33 | */ 34 | HWLHttp::~HWLHttp() 35 | { 36 | } 37 | 38 | 39 | /** 40 | * This method change the current proxy-settings and set the proxy if 41 | * using it is enabled 42 | * 43 | * @var bool b_use_proxy state, if proxy will be used or not 44 | * @var string s_proxyHost the proxyHost 45 | * @var int i_proxyPort the proxyPort 46 | * 47 | */ 48 | void HWLHttp::change_proxy(bool b_use_proxy, string s_proxyHost, int i_proxyPort) 49 | { 50 | this->o_http_client.use_proxy(b_use_proxy); 51 | 52 | if (b_use_proxy) 53 | this->o_http_client.set_current_proxy(s_proxyHost, i_proxyPort); 54 | 55 | } 56 | 57 | 58 | 59 | /** 60 | * This method return the current latest stable version of the editor itself 61 | * 62 | * @return string the current latest stable version 63 | * 64 | */ 65 | string HWLHttp::get_current_version() 66 | { 67 | this->o_http_client.set_current_url(this->s_version_check_http_url); 68 | this->o_http_client.send_http_request(); 69 | 70 | return this->o_http_client.get_current_output(); 71 | } 72 | 73 | /** 74 | * This method return the current latest nightly version of the editor itself 75 | * 76 | * @return string the current latest nightly version 77 | * 78 | */ 79 | string HWLHttp::get_current_nightly_version() 80 | { 81 | this->o_http_client.set_current_url(this->s_version_check_nightly_http_url); 82 | this->o_http_client.send_http_request(); 83 | 84 | return this->o_http_client.get_current_output(); 85 | } 86 | 87 | /** 88 | * This methods compare the current program-version with the newest version of the stable or nightly 89 | * releases and return some information + if a download is needed or not. 90 | * 91 | * @var bool b_compare_with_nightly state, if we have compare to the nightly-version 92 | * @var bool b_return_as_intString state, if we have to return the integer-representation as string 93 | * 94 | * @return string a string with information based on the compare between editor-version and latest versions 95 | * 96 | */ 97 | string HWLHttp::compare_with_current_version(bool b_compare_with_nightly, bool b_return_as_intString) 98 | { 99 | //get the current version and define a 'clean' compare-variable 100 | string s_program_version = HWLSaveEditorCore::version; 101 | string s_compare_version = ""; 102 | 103 | //check if we compare the current version with the nightly or stable-latest 104 | if (b_compare_with_nightly) 105 | s_compare_version = this->get_current_nightly_version(); 106 | else 107 | s_compare_version = this->get_current_version(); 108 | 109 | //if we have a non-empty compare version: continue, else: return error-information 110 | if (s_compare_version != "") 111 | { 112 | //get the diff-length for string compare 113 | int i_program_version_length = this->maxVersionLength - s_program_version.length(); 114 | 115 | //define variables to hold the last char (if it is really alphabetical char) 116 | char c_last_char_program_version = ' '; 117 | char c_last_char_compare_version = ' '; 118 | 119 | //check if the last char (of current version) is an alphabetical one 120 | //backup this char, and delete it from the orig string 121 | if (isalpha(s_program_version.back())) 122 | { 123 | c_last_char_program_version = s_program_version.back(); 124 | s_program_version.back() = ' '; 125 | } 126 | 127 | //check if the last char (of compare version) is an alphabetical one 128 | //backup this char, and delete it from the orig string 129 | if (isalpha(s_compare_version.back())) 130 | { 131 | c_last_char_compare_version = s_compare_version.back(); 132 | s_compare_version.back() = ' '; 133 | } 134 | 135 | //fill up the string to the max-value 136 | for (int i = 0; i < i_program_version_length; i++) { 137 | s_program_version = s_program_version + " "; 138 | } 139 | 140 | //get the diff-length for string compare 141 | i_program_version_length = this->maxVersionLength - s_compare_version.length(); 142 | 143 | //fill up the string to the max-value 144 | for (int i = 0; i < i_program_version_length; i++) { 145 | s_compare_version = s_compare_version + " "; 146 | } 147 | 148 | //if we had an backuped-last-char append it to the version-string now. 149 | if (c_last_char_program_version != ' ') 150 | s_program_version.back() = c_last_char_program_version; 151 | 152 | //if we had an backuped-last-char append it to the version-string now. 153 | if (c_last_char_compare_version != ' ') 154 | s_compare_version.back() = c_last_char_compare_version; 155 | 156 | //do a string-compare 157 | int compare = s_program_version.compare(s_compare_version); 158 | 159 | //return the compare-value as string, if we have to 160 | if (b_return_as_intString) 161 | return (to_string(compare)); 162 | 163 | //define a 'clean' output variable 164 | string s_current_output = ""; 165 | 166 | //check for the compare-value: 167 | //compare < 0 => There is a new nightly/stable version 168 | //compare == 0 => Using the newest nightly/stable version 169 | //compare > 0 => Using a nightly-version(compare to stable) or using dev-version (compare to nightly) 170 | // both is a true fact. 171 | if (compare < 0) 172 | { 173 | if (b_compare_with_nightly) 174 | s_current_output = "There is a new nightly Version, you can download at the above URL. \nBut always take care with those versions!"; 175 | else 176 | s_current_output = "There is a new stable version. \nPlease download it at the above URL!"; 177 | } 178 | else if (compare == 0) 179 | { 180 | if (b_compare_with_nightly) 181 | s_current_output = "You are using the newest nightly version."; 182 | else 183 | s_current_output = "You are using the newest stable version."; 184 | } 185 | else if (compare > 0) 186 | { 187 | if (b_compare_with_nightly) 188 | s_current_output = "You are using a dev-version which is newer and not released yet. \nNo download needed"; 189 | else 190 | s_current_output = "You are using a nightly version which is newer then the stable release. \nNo download needed!"; 191 | } 192 | 193 | //return current-output 194 | return s_current_output; 195 | } 196 | else 197 | { 198 | //return error-information 199 | return "Sorry. Couldn't retrieve the newest version. \nPlease check your internet-connection or check manually. "; 200 | } 201 | 202 | } 203 | 204 | -------------------------------------------------------------------------------- /source/core/HWLHttp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | #pragma once 5 | 6 | //include needed standard-libraries 7 | #include 8 | #include 9 | 10 | //include the main-class 11 | #include "HWLSaveEditorCore.h" 12 | 13 | //including needed third-party library/c++ wrapper 14 | #include "../libs/HTTP_Client/CHTTP_Client.h" 15 | 16 | //set user-defined content or define hardcoded-standard instead 17 | #ifndef VERSION_CHECK_NIGHTLY_HTTP_URL 18 | #define VERSION_CHECK_NIGHTLY_HTTP_URL "http://nightly.nedron92.de/hwl_save-editor/builds/version_nightly.txt" 19 | #endif 20 | 21 | #ifndef NIGHTLY_URL 22 | #define NIGHTLY_URL "https://nightly.nedron92.de/hwl_save-editor/" 23 | #endif 24 | 25 | 26 | //add the class to the project-namespace 27 | namespace HWLSaveEdit 28 | { 29 | //use the std-namespace within the project-namespace to avoid 30 | //such things like std::string etc. 31 | using namespace std; 32 | 33 | class HWLHttp 34 | { 35 | private: 36 | 37 | /* @var s_version_check_http_url the url of the version-check-file */ 38 | string s_version_check_http_url = "http://nightly.nedron92.de/hwl_save-editor/builds/version.txt"; 39 | 40 | /* @var s_version_check_nightly_http_url the url of the nightly-version-check-file, user defined */ 41 | string s_version_check_nightly_http_url = VERSION_CHECK_NIGHTLY_HTTP_URL; 42 | 43 | 44 | //needed private constants/static members 45 | static HTTP_Client o_http_client; 46 | static const int maxVersionLength; 47 | 48 | 49 | public: 50 | //needed public members/constants 51 | static const string nightlyURL; 52 | static const string latestURL; 53 | 54 | //constructor and destructor 55 | HWLHttp(); 56 | ~HWLHttp(); 57 | 58 | //method to change the proxy-settings 59 | void change_proxy(bool b_use_proxy = false, string s_proxyHost = "127.0.0.1", int i_proxyPort = 8080); 60 | 61 | //methods to get the versions and compare with current one 62 | string get_current_version(); 63 | string get_current_nightly_version(); 64 | string compare_with_current_version(bool b_compare_with_nightly = false, bool b_return_as_intString = false); 65 | }; 66 | } 67 | -------------------------------------------------------------------------------- /source/core/HWLMaterial.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | //needed for including in a MFC-App 5 | #ifdef __MFC__ 6 | #include "../gui/stdafx.h" 7 | #endif // __MFC__ 8 | 9 | //include the correct header-file 10 | #include "HWLMaterial.h" 11 | 12 | //use the project-namespace 13 | using namespace HWLSaveEdit; 14 | 15 | /* @var vs_bronzeMaterials vector for holding all names of bronze Materials */ 16 | const vector HWLMaterial::vs_bronzeMaterials = 17 | { 18 | "Metal Plate", 19 | "Monster Tooth", 20 | "Old Rag", 21 | "Soldier's Uniform", 22 | "Rock", 23 | "Aeralfos Leather", 24 | "Fiery Aeralfos Leather", 25 | "Gibdo Bandage", 26 | "Redead Bandage", 27 | "Lizalfos Scale", 28 | "Dinolfos Fang", 29 | "Moblin Flank", 30 | "Sheild-Moblin Helmet", 31 | "Piece of Darknut Armor", 32 | "Stalmaster Wrist Bone", 33 | "Big Poe Necklace", 34 | "Essence of Icy Big Poe", 35 | "Hylian Captain Gauntlet", 36 | "Goron Armor Breastplate", 37 | "Big Blin Hide", 38 | "Stone Blin Buckler", 39 | "Monster Horn" 40 | }; 41 | 42 | /* @var vs_silverMaterials vector for holding all names of silver Materials */ 43 | const vector HWLMaterial::vs_silverMaterials = 44 | { 45 | "Ganon's Mane", 46 | "King Dodongo's Claw", 47 | "Gohma's Acid", 48 | "Manhandla's Toxic Dust", 49 | "Argorok's Ember", 50 | "Imprisoned Scale", 51 | "Cia's Bracelet", 52 | "Volga's Helmet", 53 | "Wizzro's Robe", 54 | "Link's Boots", 55 | "Lana's Hair Clip", 56 | "Zelda's Brooch", 57 | "Impa's Hair Band", 58 | "Ganondorf's Gauntlet", 59 | "Sheik's Kunai", 60 | "Darunia's Spikes", 61 | "Ruto's Earrings", 62 | "Agitha's Basket", 63 | "Midna's Hair", 64 | "Fi's Heels", 65 | "Ghirahim's Sash", 66 | "Zant's Magic Gem", 67 | "Round Aeralfos Shield", 68 | "Fiery Aeralfos Wing", 69 | "Heavy Gibdo Sword", 70 | "ReDead Knight Ashes", 71 | "Lizalfos Gauntlet", 72 | "Dinolfos Arm Guard", 73 | "Moblin Spear", 74 | "Metal Moblin Shield", 75 | "Large Darknut Sword", 76 | "Stalmaster's Skull", 77 | "Big Poe's Lantern", 78 | "Icy Big Poe's Talisman", 79 | "Holy Hylian Shield", 80 | "Thick Goron Helmet", 81 | "Big Blin Club", 82 | "Stone Blin Helmet", 83 | "Helmaroc Plume", 84 | "Phantom Ganon's Cape", 85 | "Twili Midna's Hairpin", 86 | "Young Link's Belt", 87 | "Tingle's Map", 88 | "Linkle's Boots", 89 | "Skull Kid's Hat", 90 | "Pirate's Charm", 91 | "Tetra's Sandals", 92 | "King Daphnes's Robe" 93 | }; 94 | 95 | /* @var vs_goldMaterials vector for holding all names of gold Materials */ 96 | const vector HWLMaterial::vs_goldMaterials = 97 | { 98 | "Ganon's Fang", 99 | "King Dodongo's Crystal", 100 | "Gohma's Lens", 101 | "Manhandla's Sapling", 102 | "Argorok's Stone", 103 | "The Imprisoned's Pillar", 104 | "Cia's Staff", 105 | "Volga's Dragon Spear", 106 | "Wizzro's Ring", 107 | "Link's Scarf", 108 | "Lana's Cloak", 109 | "Zelda's Tiara", 110 | "Impa's Breastplate", 111 | "Ganondorf's Jewel", 112 | "Sheik's Turban", 113 | "Darunia's Bracelet", 114 | "Ruto's Scale", 115 | "Agitha's Pendant", 116 | "Midna's Fused Shadow", 117 | "Fi's Crystal", 118 | "Ghirahim's Cape", 119 | "Zant's Helmet", 120 | "Helmaroc King's Mask", 121 | "Phantom Ganon's Sword", 122 | "Twili Midna's Robe", 123 | "Keaton Mask", 124 | "Tingle's Watch", 125 | "Linkle's Compass", 126 | "Majora's Mask", 127 | "Island Outfit", 128 | "Tetra's Bandana", 129 | "King Daphnes's Crown", 130 | }; 131 | 132 | /* @var materialValueMax maximal-value of a material */ 133 | const int HWLMaterial::materialValueMax = 999; 134 | 135 | 136 | 137 | /** 138 | * Only the initialization of the normal-constructor 139 | */ 140 | HWLMaterial::HWLMaterial(string s_name, int i_offset, int i_type) 141 | { 142 | //set or calculate all needed members 143 | this->s_name = s_name; 144 | this->i_offset = i_offset; 145 | this->i_type = i_type; 146 | this->i_value = this->calc_value(); 147 | } 148 | 149 | /** 150 | * Only the initialization of the normal-destructor 151 | */ 152 | HWLMaterial::~HWLMaterial() 153 | { 154 | } 155 | 156 | 157 | 158 | /** 159 | * This method calculates the current material value 160 | * 161 | * @return int the current material-value 162 | * 163 | */ 164 | int HWLMaterial::calc_value() 165 | { 166 | //declare/define needed variables 167 | string s_material_value; 168 | int i_material_offset = this->i_offset; 169 | 170 | //get hex-value from the file-content holder and convert it to int 171 | s_material_value = this->getHexStringFromFileContent(i_material_offset, this->materialOffsetLength); 172 | int i_material_value = this->HexStringToInt(s_material_value); 173 | 174 | //return the current int-value 175 | return i_material_value; 176 | } 177 | 178 | /** 179 | * This method set the current material-value 180 | * to the file-content holder 181 | * 182 | */ 183 | void HWLMaterial::save_value() 184 | { 185 | //declare/define needed variables 186 | int i_value_tmp = this->i_value; 187 | string s_material_value; 188 | int i_material_offset = this->i_offset; 189 | 190 | //convert the current integer-value to hex and add needed zeros, if we 191 | //don't have the complete length (calculate with offset-length multiplied by 2) 192 | s_material_value = this->intToHexString(i_value_tmp, false); 193 | this->addZeroToHexString(s_material_value, this->materialOffsetLength * 2); 194 | 195 | //set converted hex-value to the file-content holder 196 | this->setHexStringToFileContent(s_material_value, i_material_offset); 197 | } 198 | 199 | 200 | 201 | /** 202 | * Setter for the material-value 203 | * 204 | * @var int i_value material-value to set 205 | * 206 | */ 207 | void HWLMaterial::set_value(int i_value) 208 | { 209 | //check if material-value smaller then 0, then set it directly to 0 210 | //also check for the maximal-value 211 | if (i_value < 0) 212 | i_value = 0; 213 | else if (i_value > this->materialValueMax) 214 | i_value = this->materialValueMax; 215 | 216 | this->i_value = i_value; 217 | 218 | } 219 | 220 | 221 | 222 | /** 223 | * Getter for the materials-name 224 | * 225 | * @return string the name of the material 226 | * 227 | */ 228 | string HWLMaterial::get_name() 229 | { 230 | return this->s_name; 231 | } 232 | 233 | /** 234 | * Getter for the materials-offset 235 | * 236 | * @return int the offset of the material 237 | * 238 | */ 239 | int HWLMaterial::get_offset() 240 | { 241 | return this->i_offset; 242 | } 243 | 244 | /** 245 | * Getter for the materials-type 246 | * 247 | * @return int the type of the material 248 | * 249 | */ 250 | int HWLMaterial::get_type() 251 | { 252 | return this->i_type; 253 | } 254 | 255 | /** 256 | * Getter for the materials-type as string 257 | * 258 | * @return string the type of the material as a string 259 | * 260 | */ 261 | string HWLMaterial::get_type(bool b_get_string) 262 | { 263 | switch (this->i_type) 264 | { 265 | case 0: 266 | return "Bronze"; 267 | break; 268 | 269 | case 1: 270 | return "Silver"; 271 | break; 272 | 273 | case 2: 274 | return "Gold"; 275 | break; 276 | 277 | default: 278 | return to_string(i_type); 279 | } 280 | } 281 | 282 | /** 283 | * Getter for the materials-value 284 | * 285 | * @return int the value of the material 286 | * 287 | */ 288 | int HWLMaterial::get_value() 289 | { 290 | return this->i_value; 291 | } 292 | 293 | 294 | 295 | /** 296 | * This method returns an formatted string, which contain all needed member-values 297 | * 298 | * @return string formatted output with all needed member-values 299 | * 300 | */ 301 | string HWLMaterial::get_MaterialForOutput() 302 | { 303 | string s_output = "Name: " + this->s_name + "\n" 304 | + " Type: " + this->get_type(true) + "\n" 305 | + " Value: " + to_string(this->i_value) + "\n"; 306 | 307 | return s_output; 308 | } 309 | 310 | 311 | 312 | /** 313 | * This method is a wrapper for all known save-methods of the class 314 | * 315 | */ 316 | void HWLMaterial::save_Material() 317 | { 318 | this->save_value(); 319 | } 320 | -------------------------------------------------------------------------------- /source/core/HWLMaterial.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | #pragma once 5 | 6 | //include the parent-class 7 | #include "HWLSaveEditorCore.h" 8 | 9 | //add the class to the project-namespace 10 | namespace HWLSaveEdit 11 | { 12 | //extend our Core-Class 13 | class HWLMaterial : public HWLSaveEditorCore 14 | { 15 | private: 16 | /* @var s_name name of the material */ 17 | string s_name; 18 | 19 | /* @var i_offset offset of the material */ 20 | int i_offset; 21 | 22 | /* @var i_type type of the material */ 23 | int i_type; 24 | 25 | /* @var i_value value of the material */ 26 | int i_value; 27 | 28 | //methods for calculation and saving the materials 29 | int calc_value(); 30 | void save_value(); 31 | 32 | public: 33 | //needed public members/constans 34 | static const vector vs_bronzeMaterials; 35 | static const vector vs_silverMaterials; 36 | static const vector vs_goldMaterials; 37 | static const int materialValueMax; 38 | 39 | //constructor and destructor 40 | HWLMaterial(string s_name, int i_offset, int i_type); 41 | ~HWLMaterial(); 42 | 43 | //method(s) for setting 44 | void set_value(int i_value); 45 | 46 | //methods for getting the members 47 | string get_name(); 48 | int get_offset(); 49 | int get_type(); 50 | string get_type(bool b_get_string); 51 | int get_value(); 52 | 53 | //method to get a formatted output (for console) 54 | string get_MaterialForOutput(); 55 | 56 | //saving method 57 | void save_Material(); 58 | 59 | }; 60 | } -------------------------------------------------------------------------------- /source/core/HWLPlayer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | #pragma once 5 | 6 | //include the parent-class and the weapon-class 7 | #include "HWLSaveEditorCore.h" 8 | #include "HWLWeapon.h" 9 | 10 | //add the class to the project-namespace 11 | namespace HWLSaveEdit 12 | { 13 | //extend our Core-Class 14 | class HWLPlayer : public HWLSaveEditorCore 15 | { 16 | private: 17 | /* @var i_id id of the character */ 18 | int i_id; 19 | 20 | /* @var s_name name of the character */ 21 | string s_name; 22 | 23 | /* @var i_offset offset of the character */ 24 | int i_offset; 25 | 26 | /* @var i_weapon_type_count number of weapon-types of the character */ 27 | int i_weapon_type_count; 28 | 29 | /* @var i_lvl lvl of the character */ 30 | int i_lvl; 31 | 32 | /* @var i_exp experience of the character */ 33 | int i_exp; 34 | 35 | /* @var i_atk attack-value of the character */ 36 | int i_atk; 37 | 38 | /* @var i_hearts heart-value of the character */ 39 | int i_hearts; 40 | 41 | /* @var b_isUnlock unlock-state of the character */ 42 | bool b_isUnlock; 43 | 44 | /* @var b_canUseAttackBadges state, if character can use Attack-Badges */ 45 | bool b_canUseAttackBadges; 46 | 47 | /* @var b_isDisabled state, if character is complety disabled (not editable) */ 48 | bool b_isDisabled; 49 | 50 | /* @var b_isDisabled vector, which hold weapon-type-IDs of chara, which are complety disabled (not editable) */ 51 | vector vi_weapon_disabled_ids; 52 | 53 | /* @var b_wasUnlocked unlock-state, if character was freshly unlocked*/ 54 | bool b_wasUnlocked; 55 | 56 | /* @var m_player_weapon holding all weapons of that character */ 57 | map> > m_player_weapon; 58 | //int-key = weapon-type, and via a weapon_slot_id access to a 59 | //single weapon 60 | 61 | //needed private static members 62 | static int si_disabledPlayerCounter; 63 | 64 | //offset-const declaration 65 | static const int playerLVLOffsetLength; 66 | static const int playerEXPOffsetLength; 67 | static const int playerATKOffsetLength; 68 | static const int playerHeartsOffsetLength; 69 | static const int playerIsUnlockOffsetLength; 70 | static const int playerCanUseAttackBadgesOffsetLength; 71 | 72 | static const int playerLVLOffsetDiff; 73 | static const int playerEXPOffsetDiff; 74 | static const int playerATKOffsetDiff; 75 | static const int playerHeartsOffsetDiff; 76 | static const int playerIsUnlockOffsetDiff; 77 | static const int playerCanUseAttackBadgesOffsetDiff; 78 | 79 | //max const declaration for stati 80 | static const vector playerLVLMax; 81 | static const vector playerEXPMax; 82 | static const vector playerATKMax; 83 | static const vector playerHeartsMax; 84 | 85 | //methods for calculation of all (known) stati-values 86 | int calc_players_lvl(); 87 | int calc_players_exp(); 88 | int calc_players_atk(); 89 | int calc_players_hearts(); 90 | bool calc_players_isUnlockState(); 91 | bool calc_players_canUseAttackBadgesState(); 92 | 93 | //methods for saving all current stati-values 94 | void save_players_lvl(); 95 | void save_players_exp(); 96 | void save_players_atk(); 97 | void save_players_hearts(); 98 | void save_players_isUnlockState(); 99 | void save_players_canUseAttackBadgesState(); 100 | 101 | public: 102 | //needed public members/constans 103 | static const vector vs_players; 104 | static const int playerIsUnlockMax; 105 | static const int playerWeaponSlotsMax; 106 | static const int playerWeaponSlotsMaxIngame; 107 | 108 | //constructor and destructor 109 | HWLPlayer(int i_id, string s_name, int i_offset, int i_weapon_type_count); 110 | ~HWLPlayer(); 111 | 112 | //methods to set and get all stati-values and also weapons 113 | void set_lvl(int i_lvl); 114 | void set_exp(int i_exp); 115 | void set_atk(int i_atk); 116 | void set_hearts(int i_hearts); 117 | void set_isUnlock(bool b_isUnlock); 118 | void set_isDisabled(bool b_isDisabled); 119 | void set_disabled_weaponTypeID(int i_weapon_type); 120 | void set_weapon_slot(int i_weapon_type, shared_ptr hwlw_weapon); 121 | void set_weapon_slot(int i_weapon_type, int i_weapon_slot, shared_ptr hwlw_weapon); 122 | 123 | int get_id(); 124 | string get_name(); 125 | int get_offset(); 126 | int get_weapon_type_count(); 127 | int get_lvl(); 128 | int get_exp(); 129 | int get_atk(); 130 | int get_hearts(); 131 | bool get_isUnlock(); 132 | bool get_isDisabled(); 133 | bool get_isWeaponTypeDisabled(int i_weapon_type); 134 | shared_ptr get_weapon_slot(int i_weapon_type, int i_weapon_slot); 135 | int get_disabledWeaponTypeCounter(); 136 | static int get_disabledPlayerCounter(); 137 | 138 | //methods to get current weapon-count and a formatted output (for console) 139 | int get_weapon_count(int i_weapon_type); 140 | string get_playersStatiForOutput(); 141 | 142 | //methods to get the current max-values for stati 143 | static int get_max_stati_value(int i_stati_id); 144 | static int get_max_stati_value(string s_stati_id); 145 | 146 | //saving method 147 | void save_Player(); 148 | 149 | //string get_sizes(); 150 | }; 151 | } -------------------------------------------------------------------------------- /source/core/HWLSaveEditor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | #pragma once 5 | #include 6 | #include //needed for compiling with gcc 7 | #include //needed for date-functions 8 | 9 | //include the other needed classes 10 | #include "HWLException.h" 11 | #include "HWLSaveEditorCore.h" 12 | #include "HWLGeneral.h" 13 | #include "HWLPlayer.h" 14 | #include "HWLMaterial.h" 15 | #include "HWLFairyFood.h" 16 | #include "HWLAdventureModeMaps.h" 17 | #include "HWLAdventureModeItems.h" 18 | #include "HWLFairy.h" 19 | #include "HWLWeapon.h" 20 | 21 | //including needed third-party libraries (HWL-Wrappers) 22 | #include "HWLHttp.h" 23 | 24 | //add the class to the project-namespace 25 | namespace HWLSaveEdit 26 | { 27 | //extend our Core-Class 28 | class HWLSaveEditor : public HWLSaveEditorCore 29 | { 30 | 31 | private: 32 | /* @var s_filepathname the path/name of the file */ 33 | string s_filepathname; 34 | 35 | /* @var fs_filehandler stream-handler for file-operations */ 36 | fstream fs_filehandler; 37 | 38 | /* @var i_filelength hold the file-length */ 39 | int i_filelength; 40 | 41 | /* @var i_error for indicate specific errors */ 42 | int i_error = 0; 43 | 44 | /* @var b_auto_trim TRUE, if auto-trim for too large savefiles are enabled, FALSE if not 45 | Default: TRUE: */ 46 | static bool b_auto_trim; 47 | 48 | string s_update_message = ""; 49 | 50 | //offset-const declaration 51 | static const int fileHeaderOffsetBegin; 52 | static const int fileNormalLength; 53 | 54 | static const int playerOffsetBegin; 55 | 56 | static const int bronzeMaterialsOffsetBegin; 57 | static const int bronzeMaterialsOffsetBeginNew; 58 | static const int silverMaterialsOffsetBegin; 59 | static const int silverMaterialsOffsetBeginNew; 60 | static const int goldMaterialsOffsetBegin; 61 | static const int goldMaterialsOffsetBeginNew; 62 | 63 | static const int fairyFoodOffsetBegin; 64 | 65 | static const int fairyOffsetBegin; 66 | 67 | static const int weaponOffsetBegin; 68 | 69 | //other const declaration 70 | static shared_ptr http_request; 71 | 72 | // member declarations 73 | /* @var sp_general pointer for holding all general things */ 74 | shared_ptr sp_general; 75 | 76 | /* @var m_players map for holding all playable characters */ 77 | map< string, shared_ptr > m_players; 78 | 79 | /* @var m_materials map for holding all foundable materials */ 80 | map< string, shared_ptr > m_materials; 81 | 82 | /* @var m_fairyfood map for holding all foundable fairyfood items */ 83 | map< string, shared_ptr > m_fairyfood; 84 | 85 | /* @var m_amItem map for holding all current Adventure-Mode Maps with their items */ 86 | map< int, shared_ptr > m_amMaps; 87 | 88 | /* @var m_fairy map for holding all myFairies */ 89 | map< int, shared_ptr > m_fairy; 90 | 91 | /* @var v_weapon vector for holding all used weapons */ 92 | vector< shared_ptr > v_weapon; 93 | 94 | /* @var vi_blank_weapons vector, which hold all free weapon offsets */ 95 | vector vi_blank_weapons; 96 | 97 | //calculate methods for generals, weapons, player, material, fairyFood, 98 | //am-items and fairies, also for setting an weapon to the correct player 99 | void calc_general(); 100 | void calc_weapons(); 101 | void calc_players(); 102 | bool calc_players_weapons(int i_player_id, int i_weapon_id, string &s_weapon_name, int &i_weapon_type, int &i_weapon_lvl, vector &vi_lvl_hexValues, bool &b_is_multi_element_weapon, int &i_multi_element_weapon_hex); 103 | void calc_materials(); 104 | void calc_fairyFood(); 105 | void calc_amMaps(); 106 | void calc_myFairies(); 107 | void calc_game_versions_restrictions(); 108 | 109 | //method for creating a backup-file 110 | void create_backup_file(); 111 | 112 | public: 113 | HWLSaveEditor(string s_filepathname = "zmha.bin", bool b_isNewSaveFile = false); 114 | ~HWLSaveEditor(); 115 | 116 | //getter for errors, general things, players(with weapons), materials, fairyFoods, 117 | //am-items and fairies 118 | int get_error(); 119 | shared_ptr get_config(); 120 | shared_ptr get_http_object(); 121 | shared_ptr get_general_things(); 122 | shared_ptr get_player(int i_id); 123 | shared_ptr get_player(string s_name); 124 | shared_ptr get_material(int i_id, int i_type); 125 | shared_ptr get_material(string s_name); 126 | shared_ptr get_fairyFood(int i_id); 127 | shared_ptr get_fairyFood(string s_name); 128 | shared_ptr get_amMap(int i_map_id); 129 | shared_ptr get_fairy(int i_id); 130 | 131 | //special getter for the number of AM-Maps we have, 132 | int get_adventureMode_maxMaps(); 133 | 134 | //method for checking file-header and file-length 135 | int check_savefile_length(); 136 | bool check_savefile(); 137 | 138 | //method for setting the automatic trim 139 | static void enable_auto_trim(bool b_auto_trim = true); 140 | 141 | //method to get the update-message 142 | string get_update_message(); 143 | 144 | //saving file method 145 | void save_file(); 146 | }; 147 | 148 | } -------------------------------------------------------------------------------- /source/core/HWLSaveEditorCore.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | #pragma once 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | //#include //for later usage with threads 12 | 13 | //include the application-wide config-class 14 | #include "HWLConfig.h" 15 | 16 | //add the class to the project-namespace 17 | namespace HWLSaveEdit 18 | { 19 | //use the std-namespace within the project-namespace to avoid 20 | //such things like std::string etc. 21 | using namespace std; 22 | 23 | class HWLSaveEditorCore 24 | { 25 | protected: 26 | //needed member in all subclasses 27 | static unsigned char *cp_filecontent; 28 | 29 | //const declaration, needed for subclasses 30 | static const int playerOffsetLength; 31 | static const int materialOffsetLength; 32 | static const int fairyFoodOffsetLength; 33 | static const int amItemOffsetLength; 34 | static const int fairyOffsetLength; 35 | static const int weaponOffsetLength; 36 | static const int weaponOffsetLengthComplete; 37 | 38 | //needed non-const members for subclasses 39 | static bool b_isNewSaveFile; 40 | static string s_savefile_game_version; 41 | static vector vb_game_dlc_installed; 42 | static shared_ptr hwlc_config; 43 | 44 | public: 45 | //needed public static-constants 46 | static const string version; 47 | 48 | /* Constructor and pure-virtual Destructor 49 | (to make the class abstract) 50 | */ 51 | HWLSaveEditorCore(); 52 | virtual ~HWLSaveEditorCore() = 0; 53 | 54 | /* Convertion for int to a HexString and the other 55 | way around with zero-adding. 56 | Also Convertions between MultiByte- and WideStrings 57 | */ 58 | string intToHexString(unsigned int i_value, bool is_file_content = true); 59 | int HexStringToInt(string s_hexString); 60 | string HexStringToByteString(string s_hexString); 61 | string ByteStringToHexString(string s_byteString); 62 | wstring ByteStringAsCharToWideString(const char* cp_multibyte_str); 63 | string WideStringAsCharToByteString(const wchar_t* wcp_wide_str); 64 | void addZeroToHexString(string &s_hexString, int i_max_length, bool b_to_end = false); 65 | 66 | //Method to convert the current byteOrder of an hexString 67 | void convertByteOrder(string &s_hexString); 68 | 69 | /* Methods to get and set content from/to the save-file */ 70 | string getHexStringFromFileContent(int i_offset, int i_offset_length, bool b_is_char = false); 71 | void setHexStringToFileContent(string s_hexString, int i_offset, bool b_is_char = false); 72 | }; 73 | } -------------------------------------------------------------------------------- /source/core/HWLWeapon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | */ 4 | #pragma once 5 | 6 | //include the parent-class 7 | #include "HWLSaveEditorCore.h" 8 | 9 | //add the class to the project-namespace 10 | namespace HWLSaveEdit 11 | { 12 | //extend our Core-Class 13 | class HWLWeapon : public HWLSaveEditorCore 14 | { 15 | private: 16 | /* @var s_name name of the weapon */ 17 | string s_name; 18 | 19 | /* @var i_offset offset of the weapon */ 20 | int i_offset; 21 | 22 | /* @var i_id id of the weapon */ 23 | int i_id; 24 | 25 | /* @var i_lvl lvl of the weapon */ 26 | int i_lvl; 27 | 28 | /* @var vi_lvl_hex lvl-hex of all lvl of the weapon */ 29 | vector vi_lvl_hex; 30 | 31 | /* @var i_damage_base damage-base of the weapon */ 32 | int i_damage_base; 33 | 34 | /* @var i_stars stars of the weapon */ 35 | int i_stars; 36 | 37 | /* @var i_damage real-damage of the weapon */ 38 | int i_damage; 39 | 40 | /* @var i_state legendary-state of the weapon */ 41 | int i_state; 42 | 43 | /* @var vi_skill_slot_kills needed-kills for the skills of the weapon */ 44 | vector vi_skill_slot_kills; 45 | 46 | /* @var vi_skill_slots skills of the weapon */ 47 | vector vi_skill_slots; 48 | 49 | /* @var i_character_id character-id of the weapon */ 50 | int i_character_id; 51 | 52 | /* @var i_type type of the weapon (depend on current character.id) */ 53 | int i_type; 54 | 55 | /* @var b_is_unsued_weapon state, if the weapon is unused */ 56 | bool b_is_unsued_weapon; 57 | 58 | /* @var b_is_multi_element_weapon state, if the weapon is a multi-element one */ 59 | bool b_is_multi_element_weapon; 60 | 61 | /* @var i_multi_element_weapon_hex hex of the weapons-multi-element type */ 62 | int i_multi_element_weapon_hex; 63 | 64 | /* @var b_weapon_has_changed state, if a weapon-state was changed */ 65 | bool b_weapon_has_changed; 66 | 67 | /* @var vi_disabledweaponSkillIDs vector, which holds disabled WeaponSkill-IDs */ 68 | static vector vi_disabledweaponSkillIDs; 69 | 70 | //offset-const declaration 71 | static const int weaponIDOffsetLength; 72 | static const int weaponDamageBaseOffsetLength; 73 | static const int weaponStarsOffsetLength; 74 | static const int weaponStateOffsetLength; 75 | static const int weaponSkillSlotKillsOffsetLength; 76 | static const int weaponSkillSlotsOffsetLength; 77 | 78 | static const int weaponIDOffsetDiff; 79 | static const int weaponDamageBaseOffsetDiff; 80 | static const int weaponStarsOffsetDiff; 81 | static const int weaponStateOffsetDiff; 82 | static const int weaponSkillSlotKillsOffsetDiff; 83 | static const int weaponSkillSlotsOffsetDiff; 84 | 85 | static const int weaponSkillSlotKillsLength; 86 | static const int weaponSkillSlotsLength; 87 | 88 | //methods for calculation of all stati-values 89 | int calc_weapon_id(); 90 | int calc_damage_base(); 91 | int calc_stars(); 92 | int calc_damage(); 93 | int calc_state(); 94 | vector calc_skill_slot_kills(); 95 | vector calc_skill_slots(); 96 | 97 | //methods for saving all current stati-values 98 | void save_weapon_id(); 99 | void save_damage_base(); 100 | void save_stars(); 101 | void save_state(); 102 | void save_skill_slot_kills(); 103 | void save_skill_slots(); 104 | 105 | public: 106 | //needed public members/constans 107 | static const vector vi_playerWeaponTypeCount; 108 | static const vector vs_playerWeaponTypeNames; 109 | static const vector vi_playerWeaponTypeHexValues; 110 | static const vector vi_playerWeaponTypeHexValuesLVL4; 111 | static const vector vi_playerWeaponTypeHexValuesMultiElement; 112 | 113 | static const vector vi_damage_base_defaults; 114 | static const vector weaponStateValuesHex; 115 | static const vector weaponStateValuesNames; 116 | static const vector weaponSkillNames; 117 | 118 | static const int weaponLVLMax; 119 | static const int weaponDamageBaseMax; 120 | static const int weaponStarsMax; 121 | static const int weaponSkillSlotKillMax; 122 | 123 | static const int weaponSkillValueNoSkill; 124 | static const string weaponBlankWeaponHex; 125 | 126 | //constructor and destructor 127 | HWLWeapon(int i_offset, int i_character_id = -1, bool b_is_unsued_weapon = false, bool b_will_copied = false); 128 | ~HWLWeapon(); 129 | 130 | //methods to set and get all stati-values 131 | void set_name(string s_name); 132 | void set_id(int i_id); 133 | void set_lvl(int i_lvl); 134 | void set_lvl_hex(vector vi_lvl_hex); 135 | void set_damage_base(int i_damage_base); 136 | void set_stars(int i_stars); 137 | void set_state(int i_state); 138 | void set_skill_slot_kill(int i_slot_id, int i_kill_value); 139 | void set_skill_kills(vector vi_skill_slot_kills); 140 | void set_skill_slot(int i_slot_id, int i_skill_id); 141 | void set_skills(vector vi_skill_slots); 142 | void set_character_id(int i_character_id); 143 | void set_type(int i_type); 144 | void set_IsUnused(bool b_is_unsued_weapon); 145 | void set_IsMultiElement(bool b_is_multi_element_weapon); 146 | void set_multi_element_hex(int i_multi_element_weapon_hex); 147 | static void set_isWeaponSkillDisabled(int i_skill_id); 148 | 149 | 150 | string get_name(); 151 | int get_id(); 152 | int get_lvl(); 153 | vector get_lvl_hex(); 154 | int get_damage_base(); 155 | int get_stars(); 156 | int get_damage(); 157 | bool get_state(); 158 | string get_state(bool b_return_as_string); 159 | int get_skill_slot_kill(int i_slot_id); 160 | vector get_skill_kills(); 161 | int get_skill_slot(int i_slot_id); 162 | string get_skill_slot(int i_slot_id, bool b_get_string); 163 | vector get_skills(); 164 | int get_character_id(); 165 | int get_type(); 166 | bool get_IsUnused(); 167 | bool get_IsMultiElement(); 168 | int get_multi_element_hex(); 169 | bool get_HasWeaponChanged(); 170 | static bool get_isWeaponSkillDisabled(int i_skill_id); 171 | static int get_WeaponSkillDisabledCounter(); 172 | 173 | //method to change the damage-base and re-calculate the damage 174 | void change_damage_base(int i_damage_base); 175 | 176 | //method to change current level and set coresspondding damage-base 177 | //re-calculate the damage 178 | void change_lvl(int i_lvl); 179 | 180 | //method to change stars and re-calculate the damage 181 | void change_stars(int i_stars); 182 | 183 | //method to change the legendary-state 184 | void change_legendary_state(int b_is_legendary); 185 | 186 | //method to change multi-element state and do needed re-calculation 187 | void change_multi_element_state(bool b_is_multi_element_weapon); 188 | 189 | //method to generate a default weapon 190 | void generate_default_weapon(bool b_is_first_weapon = false); 191 | 192 | //method to delete a weapon 193 | void delete_weapon(); 194 | 195 | //methods to get a formatted output (for console) 196 | string get_WeaponsSkillsForOutput(); 197 | string get_WeaponsForOutput(); 198 | 199 | //saving method 200 | void save_weapon(); 201 | }; 202 | 203 | 204 | } -------------------------------------------------------------------------------- /source/core/res/ZeldaHWLSaveEditorGUI.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedron92/HWL-SaveEditor/4259e42b4ee6d643859fc218e436c20c337cb358/source/core/res/ZeldaHWLSaveEditorGUI.ico -------------------------------------------------------------------------------- /source/gui/ZeldaAboutDlg.cpp: -------------------------------------------------------------------------------- 1 | // ZeldaAboutDlg.cpp: Implementierungsdatei 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "ZeldaHWLSaveEditorGUI.h" 6 | #include "ZeldaAboutDlg.h" 7 | #include "afxdialogex.h" 8 | 9 | 10 | // CZeldaAboutDlg-Dialogfeld 11 | 12 | IMPLEMENT_DYNAMIC(CZeldaAboutDlg, CDialogEx) 13 | 14 | CZeldaAboutDlg::CZeldaAboutDlg(CWnd* pParent /*=NULL*/) 15 | : CDialogEx(CZeldaAboutDlg::IDD, pParent) 16 | { 17 | } 18 | 19 | CZeldaAboutDlg::~CZeldaAboutDlg() 20 | { 21 | } 22 | 23 | void CZeldaAboutDlg::DoDataExchange(CDataExchange* pDX) 24 | { 25 | //Define to CString 26 | CString cs_app_name_version; 27 | CString cs_app_name_version_new; 28 | 29 | //Load String from String-Table, Create version CString and 30 | //Format the other CString to hold both 31 | cs_app_name_version.LoadString(IDS_APP_NAME_VERSION); 32 | CString cs_version(HWLSaveEdit::HWLSaveEditorCore::version.c_str()); 33 | cs_app_name_version_new.Format(L"%s%s", cs_app_name_version, cs_version); 34 | 35 | //Set the Dlg item to show the version at the Dialog Box 36 | SetDlgItemText(IDC_STATIC_APP_NAME, cs_app_name_version_new); 37 | 38 | CDialogEx::DoDataExchange(pDX); 39 | } 40 | 41 | 42 | BEGIN_MESSAGE_MAP(CZeldaAboutDlg, CDialogEx) 43 | END_MESSAGE_MAP() 44 | 45 | 46 | // CZeldaAboutDlg-Meldungshandler 47 | -------------------------------------------------------------------------------- /source/gui/ZeldaAboutDlg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | // CZeldaAboutDlg-Dialogfeld 5 | 6 | class CZeldaAboutDlg : public CDialogEx 7 | { 8 | DECLARE_DYNAMIC(CZeldaAboutDlg) 9 | 10 | public: 11 | CZeldaAboutDlg(CWnd* pParent = NULL); // Standardkonstruktor 12 | virtual ~CZeldaAboutDlg(); 13 | 14 | // Dialogfelddaten 15 | enum { IDD = IDD_ABOUTBOX }; 16 | 17 | protected: 18 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung 19 | 20 | DECLARE_MESSAGE_MAP() 21 | }; 22 | -------------------------------------------------------------------------------- /source/gui/ZeldaCheckForUpdatesDlg.cpp: -------------------------------------------------------------------------------- 1 | // ZeldaCheckForUpdatesDlg.cpp: Implementierungsdatei 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "ZeldaHWLSaveEditorGUI.h" 6 | #include "ZeldaCheckForUpdatesDlg.h" 7 | #include "afxdialogex.h" 8 | 9 | 10 | // CZeldaCheckForUpdatesDlg-Dialogfeld 11 | 12 | IMPLEMENT_DYNAMIC(CZeldaCheckForUpdatesDlg, CDialogEx) 13 | 14 | CZeldaCheckForUpdatesDlg::CZeldaCheckForUpdatesDlg(CWnd* pParent /*=NULL*/) 15 | : CDialogEx(CZeldaCheckForUpdatesDlg::IDD, pParent) 16 | { 17 | m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); 18 | 19 | } 20 | 21 | CZeldaCheckForUpdatesDlg::~CZeldaCheckForUpdatesDlg() 22 | { 23 | } 24 | 25 | BOOL CZeldaCheckForUpdatesDlg::OnInitDialog() 26 | { 27 | // Set the icon for this dialog. The framework does this automatically 28 | // when the application's main window is not a dialog 29 | SetIcon(m_hIcon, TRUE); // Set big icon 30 | SetIcon(m_hIcon, FALSE); // Set small icon 31 | 32 | //get the current save-object 33 | save = CZeldaHWLSaveEditorGUIApp::save; 34 | 35 | CString cs_current_version; 36 | CString cs_latest_stable_version; 37 | CString cs_latest_nightly_version; 38 | CString cs_stable_release_url; 39 | CString cs_nightly_release_url; 40 | CString cs_update_information_detail; 41 | 42 | GetDlgItemText(IDC_STATIC_CURRENT_VERSION, cs_current_version); 43 | cs_current_version += HWLSaveEdit::HWLSaveEditorCore::version.c_str(); 44 | SetDlgItemText(IDC_STATIC_CURRENT_VERSION, cs_current_version); 45 | 46 | GetDlgItemText(IDC_STATIC_LATEST_STABLE_VERSION, cs_latest_stable_version); 47 | cs_latest_stable_version += save->get_http_object()->get_current_version().c_str(); 48 | SetDlgItemText(IDC_STATIC_LATEST_STABLE_VERSION, cs_latest_stable_version); 49 | 50 | GetDlgItemText(IDC_STATIC_LATEST_NIGHTLY_VERSION, cs_latest_nightly_version); 51 | cs_latest_nightly_version += save->get_http_object()->get_current_nightly_version().c_str(); 52 | SetDlgItemText(IDC_STATIC_LATEST_NIGHTLY_VERSION, cs_latest_nightly_version); 53 | 54 | cs_stable_release_url = save->get_http_object()->latestURL.c_str(); 55 | SetDlgItemText(IDC_EDIT_STABLE_URL, cs_stable_release_url); 56 | 57 | cs_nightly_release_url = save->get_http_object()->nightlyURL.c_str(); 58 | SetDlgItemText(IDC_EDIT_NIGHTLY_URL, cs_nightly_release_url); 59 | 60 | cs_update_information_detail = save->get_http_object()->compare_with_current_version().c_str(); 61 | cs_update_information_detail += "\n AND \n"; 62 | cs_update_information_detail += save->get_http_object()->compare_with_current_version(true).c_str(); 63 | SetDlgItemText(IDC_STATIC_UPDATE_INFORMATION_DETAIL, cs_update_information_detail); 64 | 65 | this->UpdateData(); 66 | return CDialogEx::OnInitDialog(); 67 | } 68 | 69 | void CZeldaCheckForUpdatesDlg::DoDataExchange(CDataExchange* pDX) 70 | { 71 | CDialogEx::DoDataExchange(pDX); 72 | } 73 | 74 | 75 | BEGIN_MESSAGE_MAP(CZeldaCheckForUpdatesDlg, CDialogEx) 76 | END_MESSAGE_MAP() 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /source/gui/ZeldaCheckForUpdatesDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedron92/HWL-SaveEditor/4259e42b4ee6d643859fc218e436c20c337cb358/source/gui/ZeldaCheckForUpdatesDlg.h -------------------------------------------------------------------------------- /source/gui/ZeldaConfigWeaponCopyDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedron92/HWL-SaveEditor/4259e42b4ee6d643859fc218e436c20c337cb358/source/gui/ZeldaConfigWeaponCopyDlg.cpp -------------------------------------------------------------------------------- /source/gui/ZeldaConfigWeaponCopyDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedron92/HWL-SaveEditor/4259e42b4ee6d643859fc218e436c20c337cb358/source/gui/ZeldaConfigWeaponCopyDlg.h -------------------------------------------------------------------------------- /source/gui/ZeldaEditAdventureModeItem.cpp: -------------------------------------------------------------------------------- 1 | // ZeldaEditAdventureModeItem.cpp: Implementierungsdatei 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "ZeldaHWLSaveEditorGUI.h" 6 | #include "ZeldaEditAdventureModeItem.h" 7 | #include "afxdialogex.h" 8 | 9 | 10 | // CZeldaEditAdventureModeItem-Dialogfeld 11 | 12 | IMPLEMENT_DYNAMIC(CZeldaEditAdventureModeItem, CDialogEx) 13 | 14 | CZeldaEditAdventureModeItem::CZeldaEditAdventureModeItem(CWnd* pParent /*=NULL*/, int i_type) 15 | : CDialogEx(CZeldaEditAdventureModeItem::IDD, pParent) 16 | { 17 | m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); 18 | this->i_type = i_type; 19 | this->i_map = i_type+1; 20 | } 21 | 22 | CZeldaEditAdventureModeItem::~CZeldaEditAdventureModeItem() 23 | { 24 | } 25 | 26 | void CZeldaEditAdventureModeItem::DoDataExchange(CDataExchange* pDX) 27 | { 28 | // Set the icon for this dialog. The framework does this automatically 29 | // when the application's main window is not a dialog 30 | SetIcon(m_hIcon, TRUE); // Set big icon 31 | SetIcon(m_hIcon, FALSE); // Set small icon 32 | 33 | // TODO: Add extra initialization here 34 | //menu 35 | CMenu *cm_menu = GetMenu(); 36 | CMenu* cm_submenu = cm_menu->GetSubMenu(1); 37 | cm_submenu->CheckMenuItem(4, MF_CHECKED | MF_BYPOSITION); 38 | 39 | //own inits 40 | save = CZeldaHWLSaveEditorGUIApp::save; 41 | 42 | if (save != nullptr) 43 | { 44 | if (this->i_type > -1) 45 | { 46 | cm_submenu = cm_submenu->GetSubMenu(4); 47 | 48 | for (int i = 0; i < save->get_adventureMode_maxItemCount(); i++) 49 | { 50 | cm_submenu->CheckMenuItem(i, MF_UNCHECKED | MF_BYPOSITION); 51 | } 52 | 53 | cm_submenu->CheckMenuItem(this->i_type, MF_CHECKED | MF_BYPOSITION); 54 | this->i_map_max = save->get_adventureMode_maxItemCount(); 55 | CString cs_amItem_type(save->get_amItem(0,this->i_type)->get_type(true).c_str()); 56 | cs_amItem_type.Replace(L" Item", L""); 57 | SetDlgItemText(IDC_AM_MAPNAME, cs_amItem_type); 58 | 59 | 60 | if (this->i_map <= 1) 61 | GetDlgItem(IDC_AMITEM_PAGE_PREVIOUS)->EnableWindow(false); 62 | else 63 | GetDlgItem(IDC_AMITEM_PAGE_PREVIOUS)->EnableWindow(true); 64 | 65 | if (this->i_map >= this->i_map_max) 66 | GetDlgItem(IDC_AMITEM_PAGE_NEXT)->EnableWindow(false); 67 | else 68 | GetDlgItem(IDC_AMITEM_PAGE_NEXT)->EnableWindow(true); 69 | 70 | 71 | for (int i = IDC_EDIT_AMITEM1; i <= IDC_EDIT_AMITEM12; i++) 72 | { 73 | GetDlgItem(i)->EnableWindow(true); 74 | GetDlgItem(i)->ShowWindow(SW_SHOWNORMAL); 75 | } 76 | 77 | for (int i = IDC_STATIC_AMITEM1; i <= IDC_STATIC_AMITEM12; i++) 78 | { 79 | GetDlgItem(i)->EnableWindow(true); 80 | GetDlgItem(i)->ShowWindow(SW_SHOWNORMAL); 81 | } 82 | 83 | 84 | CString s_map_count; 85 | s_map_count.Format(L"%d / %d", this->i_map, this->i_map_max); 86 | SetDlgItemText(IDC_STATIC_MAP_COUNT, s_map_count); 87 | 88 | this->calc_amItems(); 89 | } 90 | }else 91 | { 92 | SetDlgItemText(IDC_AM_MAPNAME, L""); 93 | 94 | for (int i = IDC_EDIT_AMITEM1; i <= IDC_EDIT_AMITEM12; i++) 95 | { 96 | SetDlgItemText(i, L""); 97 | GetDlgItem(i)->ShowWindow(SW_SHOWNORMAL); 98 | GetDlgItem(i)->EnableWindow(false); 99 | } 100 | 101 | for (int i = IDC_STATIC_AMITEM1; i <= IDC_STATIC_AMITEM12; i++) 102 | { 103 | SetDlgItemText(i, L"AM-Items"); 104 | GetDlgItem(i)->ShowWindow(SW_SHOWNORMAL); 105 | } 106 | 107 | SetDlgItemText(IDC_STATIC_MAP_COUNT, L"0 / 0"); 108 | GetDlgItem(IDC_AMITEM_PAGE_PREVIOUS)->EnableWindow(false); 109 | GetDlgItem(IDC_AMITEM_PAGE_NEXT)->EnableWindow(false); 110 | } 111 | 112 | 113 | CDialogEx::DoDataExchange(pDX); 114 | } 115 | 116 | 117 | BEGIN_MESSAGE_MAP(CZeldaEditAdventureModeItem, CDialogEx) 118 | ON_COMMAND(ID_MENU_MAIN_EXIT, &CZeldaEditAdventureModeItem::OnMenuMainExit) 119 | ON_COMMAND(ID_MENU_EDIT_GENERAL, &CZeldaEditAdventureModeItem::OnMenuEditGeneral) 120 | ON_COMMAND(ID_MENU_EDIT_CHARACTERS_STATS, &CZeldaEditAdventureModeItem::OnMenuEditCharactersStats) 121 | ON_COMMAND(ID_MENU_EDIT_MATERIALS_BRONZE, &CZeldaEditAdventureModeItem::OnMenuEditMaterialsBronze) 122 | ON_COMMAND(ID_MENU_EDIT_MATERIALS_SILVER, &CZeldaEditAdventureModeItem::OnMenuEditMaterialsSilver) 123 | ON_COMMAND(ID_MENU_EDIT_MATERIALS_GOLD, &CZeldaEditAdventureModeItem::OnMenuEditMaterialsGold) 124 | ON_COMMAND(ID_MENU_EDIT_FAIRYFOODS, &CZeldaEditAdventureModeItem::OnMenuEditFairyfoods) 125 | ON_BN_CLICKED(ID_SAVE, &CZeldaEditAdventureModeItem::OnBnClickedSave) 126 | ON_BN_CLICKED(ID_EXIT, &CZeldaEditAdventureModeItem::OnBnClickedExit) 127 | ON_BN_CLICKED(IDC_AMITEM_PAGE_PREVIOUS, &CZeldaEditAdventureModeItem::OnBnClickedAMItemPagePrevious) 128 | ON_BN_CLICKED(IDC_AMITEM_PAGE_NEXT, &CZeldaEditAdventureModeItem::OnBnClickedAMItemPageNext) 129 | ON_CONTROL_RANGE(EN_CHANGE, IDC_EDIT_AMITEM1, IDC_EDIT_AMITEM12, &OnEnChangeValueEdit) 130 | ON_COMMAND(ID_MENU_EDIT_AM_AVMAP, &CZeldaEditAdventureModeItem::OnMenuEditAmAvmap) 131 | ON_COMMAND(ID_MENU_EDIT_AM_GSMAP, &CZeldaEditAdventureModeItem::OnMenuEditAmGsmap) 132 | ON_COMMAND(ID_MENU_EDIT_AM_MQMAP, &CZeldaEditAdventureModeItem::OnMenuEditAmMqmap) 133 | ON_BN_CLICKED(IDC_AMITEM_MAX_VALUE_MAP, &CZeldaEditAdventureModeItem::OnBnClickedAmitemMaxValueMap) 134 | ON_COMMAND(ID_MENU_EDIT_AM_TLMAP, &CZeldaEditAdventureModeItem::OnMenuEditAmTlmap) 135 | ON_COMMAND(ID_MENU_EDIT_AM_TMMAP, &CZeldaEditAdventureModeItem::OnMenuEditAmTmmap) 136 | ON_COMMAND(ID_MENU_EDIT_FAIRIES, &CZeldaEditAdventureModeItem::OnMenuEditFairies) 137 | ON_COMMAND(ID_MENU_EDIT_CHARACTERS_WEAPONS, &CZeldaEditAdventureModeItem::OnMenuEditCharactersWeapons) 138 | END_MESSAGE_MAP() 139 | 140 | 141 | // CZeldaEditAdventureModeItem-Meldungshandler 142 | void CZeldaEditAdventureModeItem::OnMenuMainExit() 143 | { 144 | // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. 145 | CZeldaEditAdventureModeItem::OnOK(); 146 | } 147 | 148 | void CZeldaEditAdventureModeItem::OnMenuEditGeneral() 149 | { 150 | // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. 151 | CZeldaEditGeneralDlg dlg; 152 | EndDialog(this->IDD); 153 | dlg.DoModal(); 154 | } 155 | 156 | void CZeldaEditAdventureModeItem::OnMenuEditCharactersStats() 157 | { 158 | // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. 159 | CZeldaEditCharaStatsDlg dlg; 160 | EndDialog(this->IDD); 161 | dlg.DoModal(); 162 | } 163 | 164 | void CZeldaEditAdventureModeItem::OnMenuEditMaterialsBronze() 165 | { 166 | // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. 167 | CZeldaEditMaterials dlg(NULL, 0); 168 | EndDialog(this->IDD); 169 | dlg.DoModal(); 170 | } 171 | 172 | void CZeldaEditAdventureModeItem::OnMenuEditMaterialsSilver() 173 | { 174 | // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. 175 | CZeldaEditMaterials dlg(NULL, 1); 176 | EndDialog(this->IDD); 177 | dlg.DoModal(); 178 | } 179 | 180 | void CZeldaEditAdventureModeItem::OnMenuEditMaterialsGold() 181 | { 182 | // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. 183 | CZeldaEditMaterials dlg(NULL, 2); 184 | EndDialog(this->IDD); 185 | dlg.DoModal(); 186 | } 187 | 188 | void CZeldaEditAdventureModeItem::OnMenuEditFairyfoods() 189 | { 190 | // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. 191 | CZeldaEditFairyFoods dlg; 192 | EndDialog(this->IDD); 193 | dlg.DoModal(); 194 | } 195 | 196 | void CZeldaEditAdventureModeItem::OnBnClickedSave() 197 | { 198 | // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. 199 | if (save != nullptr) 200 | { 201 | try 202 | { 203 | this->save_amItems(); 204 | save->save_file(); 205 | 206 | CString str("Finish! Saving the current values was successfully."); 207 | MessageBox(str, L"Information", MB_OK | MB_ICONINFORMATION); 208 | } 209 | catch (std::exception &e) 210 | { 211 | CString str(e.what()); 212 | MessageBox(str, L"Error", MB_ICONERROR); 213 | } 214 | } 215 | else{ 216 | CString str("There is no SaveFile opened!"); 217 | MessageBox(str, L"Error", MB_ICONERROR); 218 | } 219 | } 220 | 221 | void CZeldaEditAdventureModeItem::OnBnClickedExit() 222 | { 223 | // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. 224 | CZeldaEditAdventureModeItem::OnOK(); 225 | } 226 | 227 | void CZeldaEditAdventureModeItem::OnBnClickedAMItemPagePrevious() 228 | { 229 | // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. 230 | this->save_amItems(); 231 | this->i_map--; 232 | this->i_type--; 233 | this->UpdateData(); 234 | } 235 | 236 | 237 | void CZeldaEditAdventureModeItem::OnBnClickedAMItemPageNext() 238 | { 239 | // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. 240 | this->save_amItems(); 241 | this->i_map++; 242 | this->i_type++; 243 | this->UpdateData(); 244 | } 245 | 246 | void CZeldaEditAdventureModeItem::OnMenuEditAmAvmap() 247 | { 248 | // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. 249 | if (this->i_type != 0) 250 | { 251 | CZeldaEditAdventureModeItem dlg(NULL, 0); 252 | EndDialog(this->IDD); 253 | dlg.DoModal(); 254 | } 255 | } 256 | 257 | 258 | void CZeldaEditAdventureModeItem::OnMenuEditAmGsmap() 259 | { 260 | // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. 261 | if (this->i_type != 1) 262 | { 263 | CZeldaEditAdventureModeItem dlg(NULL, 1); 264 | EndDialog(this->IDD); 265 | dlg.DoModal(); 266 | } 267 | 268 | } 269 | 270 | 271 | void CZeldaEditAdventureModeItem::OnMenuEditAmMqmap() 272 | { 273 | // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. 274 | if (this->i_type != 2) 275 | { 276 | CZeldaEditAdventureModeItem dlg(NULL, 2); 277 | EndDialog(this->IDD); 278 | dlg.DoModal(); 279 | } 280 | 281 | } 282 | 283 | void CZeldaEditAdventureModeItem::OnMenuEditAmTlmap() 284 | { 285 | // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. 286 | if (this->i_type != 3) 287 | { 288 | CZeldaEditAdventureModeItem dlg(NULL, 3); 289 | EndDialog(this->IDD); 290 | dlg.DoModal(); 291 | } 292 | 293 | } 294 | 295 | void CZeldaEditAdventureModeItem::OnMenuEditAmTmmap() 296 | { 297 | // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. 298 | if (this->i_type != 4) 299 | { 300 | CZeldaEditAdventureModeItem dlg(NULL, 4); 301 | EndDialog(this->IDD); 302 | dlg.DoModal(); 303 | } 304 | } 305 | 306 | 307 | 308 | void CZeldaEditAdventureModeItem::calc_amItems() 309 | { 310 | for (int i = 0; i < this->maxAMItemsShown; i++) 311 | { 312 | CString s_amItem_name(save->get_amItem(i, this->i_type)->get_name().c_str()); 313 | CString s_amItem_value; 314 | s_amItem_value.Format(L"%d", save->get_amItem(i, this->i_type)->get_value()); 315 | 316 | SetDlgItemText((IDC_STATIC_AMITEM1 + i), s_amItem_name + L": "); 317 | SetDlgItemText((IDC_EDIT_AMITEM1 + i), s_amItem_value); 318 | 319 | CEdit *e_test = (CEdit*)GetDlgItem((IDC_EDIT_AMITEM1 + i)); 320 | CString cs_max_chars; 321 | cs_max_chars.Format(L"%d", HWLSaveEdit::HWLAdventureModeItems::amItemValueMax); 322 | e_test->SetLimitText(cs_max_chars.GetLength() + 1); 323 | } 324 | } 325 | 326 | void CZeldaEditAdventureModeItem::save_amItems() 327 | { 328 | for (int i = 0; i < this->maxAMItemsShown; i++) 329 | { 330 | CString s_amItem_value; 331 | 332 | GetDlgItemText((IDC_EDIT_AMITEM1 + i), s_amItem_value); 333 | int i_amItem_value = _wtof(s_amItem_value); 334 | 335 | save->get_amItem(i, this->i_type)->set_value(i_amItem_value); 336 | save->get_amItem(i, this->i_type)->save_AMItem(); 337 | } 338 | } 339 | 340 | void CZeldaEditAdventureModeItem::OnEnChangeValueEdit(UINT nID) 341 | { 342 | if (SendDlgItemMessage(nID, EM_GETMODIFY, 0, 0)) 343 | { 344 | if (save != nullptr) 345 | { 346 | CString test; 347 | CEdit *e_test = (CEdit*)GetDlgItem(nID); 348 | CString cs_max_chars; 349 | cs_max_chars.Format(L"%d", HWLSaveEdit::HWLAdventureModeItems::amItemValueMax); 350 | e_test->SetLimitText(cs_max_chars.GetLength()+1); 351 | GetDlgItemText(nID, test); 352 | int i_test = _wtoi(test); 353 | 354 | if (i_test > HWLSaveEdit::HWLAdventureModeItems::amItemValueMax) 355 | { 356 | test.Format(L"%d", HWLSaveEdit::HWLAdventureModeItems::amItemValueMax); 357 | SetDlgItemText(nID, test); 358 | e_test->SetLimitText(cs_max_chars.GetLength()); 359 | } 360 | 361 | } 362 | } 363 | } 364 | 365 | void CZeldaEditAdventureModeItem::OnBnClickedAmitemMaxValueMap() 366 | { 367 | // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. 368 | if (save != nullptr) 369 | { 370 | for (int i = 0; i < this->maxAMItemsShown; i++) 371 | { 372 | save->get_amItem(i, this->i_type)->set_value(HWLSaveEdit::HWLAdventureModeItems::amItemValueMax); 373 | save->get_amItem(i, this->i_type)->save_AMItem(); 374 | } 375 | 376 | this->UpdateData(); 377 | 378 | CString str("Finish! All needed Values are updated."); 379 | MessageBox(str, L"Information", MB_OK | MB_ICONINFORMATION); 380 | } 381 | 382 | } 383 | 384 | 385 | 386 | void CZeldaEditAdventureModeItem::OnMenuEditFairies() 387 | { 388 | // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. 389 | CZeldaEditFairyDlg dlg; 390 | EndDialog(this->IDD); 391 | dlg.DoModal(); 392 | } 393 | 394 | 395 | void CZeldaEditAdventureModeItem::OnMenuEditCharactersWeapons() 396 | { 397 | // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. 398 | CZeldaEditCharaWeaponsDlg dlg; 399 | EndDialog(this->IDD); 400 | dlg.DoModal(); 401 | } 402 | -------------------------------------------------------------------------------- /source/gui/ZeldaEditAdventureModeItem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | // CZeldaEditAdventureModeItem-Dialogfeld 5 | 6 | class CZeldaEditAdventureModeItem : public CDialogEx 7 | { 8 | DECLARE_DYNAMIC(CZeldaEditAdventureModeItem) 9 | 10 | public: 11 | CZeldaEditAdventureModeItem(CWnd* pParent = NULL, int i_type = -1); // Standardkonstruktor 12 | virtual ~CZeldaEditAdventureModeItem(); 13 | 14 | // Dialogfelddaten 15 | enum { IDD = IDD_EDIT_AMITEM }; 16 | 17 | protected: 18 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung 19 | 20 | HICON m_hIcon; 21 | HWLSaveEdit::HWLSaveEditor *save; 22 | int i_type; 23 | int i_map; 24 | int i_map_max; 25 | const int maxAMItemsShown = 12; 26 | 27 | DECLARE_MESSAGE_MAP() 28 | 29 | //own methods 30 | void calc_amItems(); 31 | void save_amItems(); 32 | 33 | public: 34 | 35 | afx_msg void OnEnChangeValueEdit(UINT nID); 36 | 37 | afx_msg void OnMenuMainExit(); 38 | afx_msg void OnMenuEditGeneral(); 39 | afx_msg void OnMenuEditCharactersStats(); 40 | afx_msg void OnMenuEditMaterialsBronze(); 41 | afx_msg void OnMenuEditMaterialsSilver(); 42 | afx_msg void OnMenuEditMaterialsGold(); 43 | afx_msg void OnMenuEditFairyfoods(); 44 | 45 | afx_msg void OnBnClickedSave(); 46 | afx_msg void OnBnClickedExit(); 47 | afx_msg void OnBnClickedAMItemPagePrevious(); 48 | afx_msg void OnBnClickedAMItemPageNext(); 49 | afx_msg void OnMenuEditAmAvmap(); 50 | afx_msg void OnMenuEditAmGsmap(); 51 | afx_msg void OnMenuEditAmMqmap(); 52 | afx_msg void OnBnClickedAmitemMaxValueMap(); 53 | afx_msg void OnMenuEditAmTlmap(); 54 | afx_msg void OnMenuEditAmTmmap(); 55 | afx_msg void OnMenuEditFairies(); 56 | afx_msg void OnMenuEditCharactersWeapons(); 57 | }; 58 | -------------------------------------------------------------------------------- /source/gui/ZeldaEditAdventureModeMaps.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | // CZeldaEditAdventureModeMaps-Dialogfeld 5 | 6 | class CZeldaEditAdventureModeMaps : public CDialogEx 7 | { 8 | DECLARE_DYNAMIC(CZeldaEditAdventureModeMaps) 9 | 10 | public: 11 | CZeldaEditAdventureModeMaps(CWnd* pParent = NULL, int i_map = -1, int i_skipped_maps = 0); // Standardkonstruktor 12 | virtual ~CZeldaEditAdventureModeMaps(); 13 | 14 | // Dialogfelddaten 15 | enum { IDD = IDD_EDIT_AMMAPS }; 16 | 17 | protected: 18 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung 19 | virtual BOOL OnInitDialog(); 20 | 21 | HICON m_hIcon; 22 | HWLSaveEdit::HWLSaveEditor *save; 23 | int i_map, i_skipped_maps; 24 | 25 | DECLARE_MESSAGE_MAP() 26 | 27 | //own methods 28 | void calc_amItems(); 29 | void save_amItems(); 30 | 31 | public: 32 | 33 | afx_msg void OnEnChangeValueEdit(UINT nID); 34 | 35 | afx_msg void OnMenuMainExit(); 36 | afx_msg void OnMenuEditGeneral(); 37 | afx_msg void OnMenuEditCharactersStats(); 38 | afx_msg void OnMenuEditMaterialsBronze(); 39 | afx_msg void OnMenuEditMaterialsSilver(); 40 | afx_msg void OnMenuEditMaterialsGold(); 41 | afx_msg void OnMenuEditFairyfoods(); 42 | 43 | afx_msg void OnBnClickedSave(); 44 | afx_msg void OnBnClickedExit(); 45 | afx_msg void OnBnClickedAMItemPagePrevious(); 46 | afx_msg void OnBnClickedAMItemPageNext(); 47 | afx_msg void OnMenuEditAmAvmap(); 48 | afx_msg void OnMenuEditAmGsmap(); 49 | afx_msg void OnMenuEditAmMqmap(); 50 | afx_msg void OnBnClickedAmitemMaxValueMap(); 51 | afx_msg void OnMenuEditAmTlmap(); 52 | afx_msg void OnMenuEditAmTmmap(); 53 | afx_msg void OnMenuEditFairies(); 54 | afx_msg void OnMenuEditCharactersWeapons(); 55 | afx_msg void OnMenuEditAmMwwmap(); 56 | afx_msg void OnMenuEditAmKimap(); 57 | afx_msg void OnMenuEditAmGtmap(); 58 | afx_msg void OnBnClickedAmmapMaxValueAll(); 59 | afx_msg void OnMenuEditCharactersOverview(); 60 | afx_msg void OnMenuEditAmLrmap(); 61 | }; 62 | -------------------------------------------------------------------------------- /source/gui/ZeldaEditCharaOverviewDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedron92/HWL-SaveEditor/4259e42b4ee6d643859fc218e436c20c337cb358/source/gui/ZeldaEditCharaOverviewDlg.cpp -------------------------------------------------------------------------------- /source/gui/ZeldaEditCharaOverviewDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedron92/HWL-SaveEditor/4259e42b4ee6d643859fc218e436c20c337cb358/source/gui/ZeldaEditCharaOverviewDlg.h -------------------------------------------------------------------------------- /source/gui/ZeldaEditCharaStatsDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedron92/HWL-SaveEditor/4259e42b4ee6d643859fc218e436c20c337cb358/source/gui/ZeldaEditCharaStatsDlg.cpp -------------------------------------------------------------------------------- /source/gui/ZeldaEditCharaStatsDlg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | // CZeldaEditCharaStatsDlg-Dialogfeld 5 | 6 | class CZeldaEditCharaStatsDlg : public CDialogEx 7 | { 8 | DECLARE_DYNAMIC(CZeldaEditCharaStatsDlg) 9 | 10 | public: 11 | CZeldaEditCharaStatsDlg(CWnd* pParent = NULL, int i_chara_id = 0, int i_skipped_charas = 0); // Standardkonstruktor 12 | virtual ~CZeldaEditCharaStatsDlg(); 13 | 14 | // Dialogfelddaten 15 | enum { IDD = IDD_EDIT_CHARA_STATS }; 16 | 17 | protected: 18 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung 19 | virtual BOOL OnInitDialog(); 20 | 21 | HICON m_hIcon; 22 | 23 | HWLSaveEdit::HWLSaveEditor *save; 24 | int i_chara_id, i_skipped_charas; 25 | 26 | DECLARE_MESSAGE_MAP() 27 | 28 | public: 29 | afx_msg void OnBnClickedExit(); 30 | afx_msg void OnBnClickedSave(); 31 | 32 | //own methods 33 | void calc_stats(); 34 | void save_stats(); 35 | afx_msg void OnMenuAbout(); 36 | afx_msg void OnMenuEditGeneral(); 37 | afx_msg void OnMenuEditCharactersStats(); 38 | afx_msg void OnMenuEditMaterialsBronze(); 39 | afx_msg void OnMenuEditMaterialsSilver(); 40 | afx_msg void OnMenuEditMaterialsGold(); 41 | afx_msg void OnMenuMainExit(); 42 | afx_msg void OnMenuEditFairyfoods(); 43 | afx_msg void OnMenuEditAmAvmap(); 44 | afx_msg void OnMenuEditAmGsmap(); 45 | afx_msg void OnMenuEditAmMqmap(); 46 | afx_msg void OnMenuEditAmTlmap(); 47 | afx_msg void OnMenuEditAmTmmap(); 48 | afx_msg void OnMenuEditFairies(); 49 | afx_msg void OnMenuEditCharactersWeapons(); 50 | afx_msg void OnMenuEditAmMwwmap(); 51 | afx_msg void OnMenuEditAmKimap(); 52 | afx_msg void OnMenuEditAmGtmap(); 53 | afx_msg void OnMenuEditCharactersOverview(); 54 | afx_msg void OnBnClickedButtonCstatsEditWeapons(); 55 | afx_msg void OnBnClickedButtonCstatsMaxStatsUsedWeapons(); 56 | afx_msg void OnBnClickedCstatsCharaMaxStats(); 57 | afx_msg void OnBnClickedCstatsPagePrevious(); 58 | afx_msg void OnBnClickedCstatsPageNext(); 59 | afx_msg void OnEnChangeEditCstatsCharaLvl(); 60 | afx_msg void OnEnChangeEditCstatsCharaExp(); 61 | afx_msg void OnEnChangeEditCstatsCharaAtk(); 62 | afx_msg void OnEnChangeEditCstatsCharaHearts(); 63 | afx_msg void OnBnClickedCheckCstatsCharaUnlock(); 64 | afx_msg void OnMenuEditAmLrmap(); 65 | }; 66 | 67 | -------------------------------------------------------------------------------- /source/gui/ZeldaEditCharaWeaponsDlg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | // CZeldaEditCharaWeaponsDlg-Dialogfeld 5 | 6 | class CZeldaEditCharaWeaponsDlg : public CDialogEx 7 | { 8 | DECLARE_DYNAMIC(CZeldaEditCharaWeaponsDlg) 9 | 10 | public: 11 | CZeldaEditCharaWeaponsDlg(CWnd* pParent = NULL, int i_chara_id = 0, int i_skipped_charas = 0); // Standardkonstruktor 12 | virtual ~CZeldaEditCharaWeaponsDlg(); 13 | 14 | // Dialogfelddaten 15 | enum { IDD = IDD_EDIT_CHARA_WEAPONS }; 16 | 17 | protected: 18 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung 19 | virtual BOOL OnInitDialog(); 20 | 21 | HICON m_hIcon; 22 | HWLSaveEdit::HWLSaveEditor *save; 23 | int i_chara_id, i_weapon_type, i_weapon_slot, i_skipped_charas, i_skipped_weaponTypes, i_disabledWeaponSkillsCounter; 24 | 25 | DECLARE_MESSAGE_MAP() 26 | 27 | //own methods 28 | void calc_weapon(); 29 | void save_weapon(); 30 | 31 | public: 32 | afx_msg void OnEnChangeKillSlotEdit(UINT nID); 33 | 34 | afx_msg void OnMenuEditGeneral(); 35 | afx_msg void OnMenuEditCharactersStats(); 36 | afx_msg void OnMenuEditCharactersWeapons(); 37 | afx_msg void OnMenuEditMaterialsBronze(); 38 | afx_msg void OnMenuEditMaterialsSilver(); 39 | afx_msg void OnMenuEditMaterialsGold(); 40 | afx_msg void OnMenuEditFairyfoods(); 41 | afx_msg void OnMenuEditAmAvmap(); 42 | afx_msg void OnMenuEditAmGsmap(); 43 | afx_msg void OnMenuEditAmMqmap(); 44 | afx_msg void OnMenuEditAmTlmap(); 45 | afx_msg void OnMenuEditAmTmmap(); 46 | afx_msg void OnMenuEditFairies(); 47 | afx_msg void OnBnClickedSave(); 48 | afx_msg void OnBnClickedExit(); 49 | afx_msg void OnBnClickedCweaponCharPagePrevious(); 50 | afx_msg void OnBnClickedCweaponCharPageNext(); 51 | afx_msg void OnBnClickedCweaponTypePagePrevious(); 52 | afx_msg void OnBnClickedCweaponTypePageNext(); 53 | afx_msg void OnBnClickedCweaponSlotPagePrevious(); 54 | afx_msg void OnBnClickedCweaponSlotPageNext(); 55 | afx_msg void OnBnClickedCweaponDefaultWeapon(); 56 | afx_msg void OnBnClickedCweaponDeleteWeapon(); 57 | afx_msg void OnCbnSelchangeComboCweaponLevel(); 58 | afx_msg void OnEnChangeEditCweaponDamageBase(); 59 | afx_msg void OnEnKillfocusEditCweaponDamageBase(); 60 | afx_msg void OnBnClickedCheckCweaponLegendary(); 61 | afx_msg void OnBnClickedCweaponResetKills(); 62 | afx_msg void OnBnClickedCweaponResetSkills(); 63 | afx_msg void OnCbnSelchangeComboCweaponStars(); 64 | afx_msg void OnMenuEditAmMwwmap(); 65 | afx_msg void OnMenuEditAmKimap(); 66 | afx_msg void OnMenuEditAmGtmap(); 67 | afx_msg void OnBnClickedCheckCweaponMultielement(); 68 | afx_msg void OnMenuMainExit(); 69 | afx_msg void OnMenuEditCharactersOverview(); 70 | afx_msg void OnBnClickedCweaponCopyValues(); 71 | afx_msg void OnBnClickedCweaponPasteValues(); 72 | afx_msg void OnMenuEditAmLrmap(); 73 | }; 74 | -------------------------------------------------------------------------------- /source/gui/ZeldaEditFairyDlg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | // CZeldaEditFairyDlg-Dialogfeld 5 | 6 | class CZeldaEditFairyDlg : public CDialogEx 7 | { 8 | DECLARE_DYNAMIC(CZeldaEditFairyDlg) 9 | 10 | public: 11 | CZeldaEditFairyDlg(CWnd* pParent = NULL); // Standardkonstruktor 12 | virtual ~CZeldaEditFairyDlg(); 13 | 14 | // Dialogfelddaten 15 | enum { IDD = IDD_EDIT_FAIRIES }; 16 | 17 | protected: 18 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung 19 | virtual BOOL OnInitDialog(); 20 | 21 | HICON m_hIcon; 22 | HWLSaveEdit::HWLSaveEditor *save; 23 | int i_fairy; 24 | int i_fairy_max; 25 | 26 | DECLARE_MESSAGE_MAP() 27 | 28 | //own methods 29 | void calc_fairy(); 30 | void save_fairy(); 31 | 32 | public: 33 | afx_msg void OnMenuEditFairies(); 34 | afx_msg void OnMenuEditGeneral(); 35 | afx_msg void OnMenuEditCharactersStats(); 36 | afx_msg void OnMenuEditMaterialsBronze(); 37 | afx_msg void OnMenuEditMaterialsSilver(); 38 | afx_msg void OnMenuEditMaterialsGold(); 39 | afx_msg void OnMenuEditFairyfoods(); 40 | afx_msg void OnMenuEditAmAvmap(); 41 | afx_msg void OnMenuEditAmGsmap(); 42 | afx_msg void OnMenuEditAmMqmap(); 43 | afx_msg void OnMenuEditAmTlmap(); 44 | afx_msg void OnMenuEditAmTmmap(); 45 | afx_msg void OnBnClickedSave(); 46 | afx_msg void OnBnClickedExit(); 47 | afx_msg void OnBnClickedFairyPagePrevious(); 48 | afx_msg void OnBnClickedFairyPageNext(); 49 | afx_msg void OnBnClickedFairyMaxStats(); 50 | afx_msg void OnEnChangeEditFairyLvl(); 51 | afx_msg void OnEnChangeEditFairyTrust(); 52 | afx_msg void OnEnChangeEditFairyIterator(); 53 | afx_msg void OnMenuEditCharactersWeapons(); 54 | afx_msg void OnMenuEditAmMwwmap(); 55 | afx_msg void OnMenuEditAmKimap(); 56 | afx_msg void OnMenuEditAmGtmap(); 57 | afx_msg void OnBnClickedFairyMaxStatsAll(); 58 | afx_msg void OnBnClickedFairyUnlockAll(); 59 | afx_msg void OnMenuMainExit(); 60 | afx_msg void OnMenuEditCharactersOverview(); 61 | afx_msg void OnMenuEditAmLrmap(); 62 | }; 63 | -------------------------------------------------------------------------------- /source/gui/ZeldaEditFairyFoods.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | // CZeldaEditFairyFoods-Dialogfeld 5 | 6 | class CZeldaEditFairyFoods : public CDialogEx 7 | { 8 | DECLARE_DYNAMIC(CZeldaEditFairyFoods) 9 | 10 | public: 11 | CZeldaEditFairyFoods(CWnd* pParent = NULL); // Standardkonstruktor 12 | virtual ~CZeldaEditFairyFoods(); 13 | 14 | // Dialogfelddaten 15 | enum { IDD = IDD_EDIT_FAIRYFOODS }; 16 | 17 | protected: 18 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung 19 | virtual BOOL OnInitDialog(); 20 | 21 | HICON m_hIcon; 22 | HWLSaveEdit::HWLSaveEditor *save; 23 | int i_page; 24 | int i_page_max; 25 | const int maxFairyFoodsShown = 30; 26 | 27 | DECLARE_MESSAGE_MAP() 28 | 29 | //own methods 30 | void calc_fairyFood(); 31 | void save_fairyFood(); 32 | 33 | public: 34 | 35 | afx_msg void OnEnChangeValueEdit(UINT nID); 36 | 37 | afx_msg void OnMenuAbout(); 38 | afx_msg void OnMenuEditGeneral(); 39 | afx_msg void OnMenuEditCharactersStats(); 40 | afx_msg void OnMenuEditMaterialsBronze(); 41 | afx_msg void OnMenuEditMaterialsSilver(); 42 | afx_msg void OnMenuEditMaterialsGold(); 43 | afx_msg void OnMenuMainExit(); 44 | afx_msg void OnMenuEditFairyfoods(); 45 | afx_msg void OnBnClickedExit(); 46 | afx_msg void OnBnClickedSave(); 47 | afx_msg void OnBnClickedFairyfoodPagePrevious(); 48 | afx_msg void OnBnClickedFairyfoodPageNext(); 49 | afx_msg void OnMenuEditAmAvmap(); 50 | afx_msg void OnMenuEditAmGsmap(); 51 | afx_msg void OnMenuEditAmMqmap(); 52 | afx_msg void OnBnClickedFairyfoodMaxValuePage(); 53 | afx_msg void OnBnClickedFairyfoodMaxValueAll(); 54 | afx_msg void OnBnClickedFairyfoodMaxValueGratitude(); 55 | afx_msg void OnMenuEditAmTlmap(); 56 | afx_msg void OnMenuEditAmTmmap(); 57 | afx_msg void OnMenuEditFairies(); 58 | afx_msg void OnMenuEditCharactersWeapons(); 59 | afx_msg void OnMenuEditAmMwwmap(); 60 | afx_msg void OnMenuEditAmKimap(); 61 | afx_msg void OnMenuEditAmGtmap(); 62 | afx_msg void OnMenuEditCharactersOverview(); 63 | afx_msg void OnMenuEditAmLrmap(); 64 | }; 65 | -------------------------------------------------------------------------------- /source/gui/ZeldaEditGeneralDlg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // CZeldaEditGeneralDlg-Dialogfeld 4 | 5 | class CZeldaEditGeneralDlg : public CDialogEx 6 | { 7 | DECLARE_DYNAMIC(CZeldaEditGeneralDlg) 8 | 9 | public: 10 | CZeldaEditGeneralDlg(CWnd* pParent = NULL); // Standardkonstruktor 11 | virtual ~CZeldaEditGeneralDlg(); 12 | 13 | // Dialogfelddaten 14 | enum { IDD = IDD_EDIT_GENERAL }; 15 | 16 | protected: 17 | HICON m_hIcon; 18 | 19 | HWLSaveEdit::HWLSaveEditor *save; 20 | 21 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung 22 | virtual BOOL OnInitDialog(); 23 | 24 | DECLARE_MESSAGE_MAP() 25 | 26 | //own methods 27 | void calc_general(); 28 | void save_general(); 29 | 30 | public: 31 | afx_msg void OnBnClickedSave(); 32 | afx_msg void OnBnClickedExit(); 33 | afx_msg void OnMenuEditCharactersStats(); 34 | afx_msg void OnMenuAbout(); 35 | afx_msg void OnEnChangeRubyEdit(); 36 | afx_msg void OnMenuMainFileOpen(); 37 | 38 | void calc_disabledState_AmMaps(); 39 | int get_active_window_id(); 40 | afx_msg void OnMenuMainFileClose(); 41 | afx_msg void OnMenuMainExit(); 42 | afx_msg void OnMenuEditMaterialsBronze(); 43 | afx_msg void OnMenuEditMaterialsSilver(); 44 | afx_msg void OnMenuEditMaterialsGold(); 45 | afx_msg void OnMenuEditFairyfoods(); 46 | afx_msg void OnMenuEditAmAvmap(); 47 | afx_msg void OnMenuEditAmGsmap(); 48 | afx_msg void OnMenuEditAmMqmap(); 49 | afx_msg void OnMenuEditGeneral(); 50 | afx_msg void OnBnClickedRubyMax(); 51 | afx_msg void OnMenuEditAmTlmap(); 52 | afx_msg void OnMenuEditAmTmmap(); 53 | afx_msg void OnMenuEditFairies(); 54 | afx_msg void OnMenuEditCharactersWeapons(); 55 | afx_msg void OnBnClickedButtonHelpUnlockWeaponStates(); 56 | afx_msg void OnBnClickedButtonHelpUnlockAllMaterials(); 57 | afx_msg void OnBnClickedStaticGeneral(); 58 | afx_msg void OnMenuCheckforupdates(); 59 | afx_msg void OnMenuEditAmMwwmap(); 60 | afx_msg void OnMenuEditAmKimap(); 61 | afx_msg void OnMenuEditAmGtmap(); 62 | afx_msg void OnMenuEditCharactersOverview(); 63 | afx_msg void OnMenuEditAmLrmap(); 64 | }; 65 | -------------------------------------------------------------------------------- /source/gui/ZeldaEditMaterials.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | // CZeldaEditMaterials-Dialogfeld 5 | 6 | class CZeldaEditMaterials : public CDialogEx 7 | { 8 | DECLARE_DYNAMIC(CZeldaEditMaterials) 9 | 10 | public: 11 | CZeldaEditMaterials(CWnd* pParent = NULL, int i_type=-1); // Standardkonstruktor 12 | 13 | virtual ~CZeldaEditMaterials(); 14 | 15 | // Dialogfelddaten 16 | enum { IDD = IDD_EDIT_MATERIALS }; 17 | 18 | protected: 19 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung 20 | virtual BOOL OnInitDialog(); 21 | 22 | HICON m_hIcon; 23 | HWLSaveEdit::HWLSaveEditor *save; 24 | int i_type; 25 | int i_page; 26 | int i_page_max; 27 | const int maxMaterialsShown = 30; 28 | 29 | DECLARE_MESSAGE_MAP() 30 | 31 | //own methods 32 | void calc_materials(); 33 | void save_materials(); 34 | 35 | public: 36 | 37 | afx_msg void OnEnChangeValueEdit(UINT nID); 38 | 39 | afx_msg void OnMenuEditGeneral(); 40 | afx_msg void OnMenuEditCharactersStats(); 41 | afx_msg void OnMenuEditMaterialsBronze(); 42 | afx_msg void OnBnClickedExit(); 43 | afx_msg void OnBnClickedCancel(); 44 | afx_msg void OnBnClickedSave(); 45 | afx_msg void OnMenuEditMaterialsSilver(); 46 | afx_msg void OnBnClickedMaterialPagePrevious(); 47 | afx_msg void OnBnClickedMaterialPageNext(); 48 | afx_msg void OnMenuEditMaterialsGold(); 49 | afx_msg void OnMenuMainExit(); 50 | afx_msg void OnMenuEditFairyfoods(); 51 | afx_msg void OnMenuEditAmAvmap(); 52 | afx_msg void OnMenuEditAmGsmap(); 53 | afx_msg void OnMenuEditAmMqmap(); 54 | afx_msg void OnBnClickedMaterialMaxValueAll(); 55 | afx_msg void OnMenuEditAmTlmap(); 56 | afx_msg void OnMenuEditAmTmmap(); 57 | afx_msg void OnMenuEditFairies(); 58 | afx_msg void OnMenuEditCharactersWeapons(); 59 | afx_msg void OnMenuEditAmMwwmap(); 60 | afx_msg void OnMenuEditAmKimap(); 61 | afx_msg void OnMenuEditAmGtmap(); 62 | afx_msg void OnMenuEditCharactersOverview(); 63 | afx_msg void OnMenuEditAmLrmap(); 64 | }; 65 | -------------------------------------------------------------------------------- /source/gui/ZeldaHWLSaveEditorGUI.cpp: -------------------------------------------------------------------------------- 1 | 2 | // ZeldaHWLSaveEditorGUI.cpp : Defines the class behaviors for the application. 3 | // 4 | 5 | #include "stdafx.h" 6 | #include "ZeldaHWLSaveEditorGUI.h" 7 | 8 | 9 | #ifdef _DEBUG 10 | #define new DEBUG_NEW 11 | #endif 12 | 13 | 14 | // CZeldaHWLSaveEditorGUIApp 15 | 16 | BEGIN_MESSAGE_MAP(CZeldaHWLSaveEditorGUIApp, CWinApp) 17 | ON_COMMAND(ID_HELP, &CWinApp::OnHelp) 18 | END_MESSAGE_MAP() 19 | 20 | 21 | // CZeldaHWLSaveEditorGUIApp construction 22 | 23 | CZeldaHWLSaveEditorGUIApp::CZeldaHWLSaveEditorGUIApp() 24 | { 25 | // support Restart Manager 26 | m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART; 27 | 28 | // TODO: add construction code here, 29 | // Place all significant initialization in InitInstance 30 | } 31 | 32 | 33 | // The one and only CZeldaHWLSaveEditorGUIApp object 34 | 35 | CZeldaHWLSaveEditorGUIApp theApp; 36 | 37 | 38 | // CZeldaHWLSaveEditorGUIApp initialization 39 | //initialize the static-member 40 | HWLSaveEdit::HWLSaveEditor *CZeldaHWLSaveEditorGUIApp::save = nullptr; 41 | std::shared_ptr CZeldaHWLSaveEditorGUIApp::sp_weapon_copy = nullptr; 42 | 43 | map CZeldaHWLSaveEditorGUIApp::mib_disabled_adventure_maps; 44 | map CZeldaHWLSaveEditorGUIApp::mib_config_copy_weapon_values; 45 | 46 | BOOL CZeldaHWLSaveEditorGUIApp::InitInstance() 47 | { 48 | // InitCommonControlsEx() is required on Windows XP if an application 49 | // manifest specifies use of ComCtl32.dll version 6 or later to enable 50 | // visual styles. Otherwise, any window creation will fail. 51 | INITCOMMONCONTROLSEX InitCtrls; 52 | InitCtrls.dwSize = sizeof(InitCtrls); 53 | // Set this to include all the common control classes you want to use 54 | // in your application. 55 | InitCtrls.dwICC = ICC_WIN95_CLASSES; 56 | InitCommonControlsEx(&InitCtrls); 57 | 58 | CWinApp::InitInstance(); 59 | 60 | AfxEnableControlContainer(); 61 | 62 | // Create the shell manager, in case the dialog contains 63 | // any shell tree view or shell list view controls. 64 | CShellManager *pShellManager = new CShellManager; 65 | 66 | // Activate "Windows Native" visual manager for enabling themes in MFC controls 67 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); 68 | 69 | // Standard initialization 70 | // If you are not using these features and wish to reduce the size 71 | // of your final executable, you should remove from the following 72 | // the specific initialization routines you do not need 73 | // Change the registry key under which our settings are stored 74 | // TODO: You should modify this string to be something appropriate 75 | // such as the name of your company or organization 76 | //SetRegistryKey(_T("Local AppWizard-Generated Applications")); 77 | 78 | CZeldaEditGeneralDlg dlg; 79 | bool b_is_update_check = false; 80 | INT_PTR nResponse; 81 | 82 | //get the current command-line parameter 83 | CString cs_cmd_param = theApp.m_lpCmdLine; 84 | 85 | //check if we have to disable the auto-trim function or not 86 | if (cs_cmd_param == L"--disable-auto-trim") 87 | { 88 | HWLSaveEdit::HWLSaveEditor::enable_auto_trim(false); 89 | } 90 | 91 | //check if we have only to check for updates 92 | if (cs_cmd_param == L"--check-updates") 93 | { 94 | b_is_update_check = true; 95 | } 96 | 97 | //check if we have to try to create a new default-config-file 98 | if (cs_cmd_param == L"--create-default-config") 99 | { 100 | HWLSaveEdit::HWLConfig hwlc_tmp_config = HWLSaveEdit::HWLConfig(false); 101 | 102 | try 103 | { 104 | hwlc_tmp_config.write_config(); 105 | MessageBox(dlg, CString("A new default-config was created successfully."), L"Information", MB_OK | MB_ICONINFORMATION); 106 | return FALSE; 107 | } 108 | catch (HWLSaveEdit::HWLException &e) 109 | { 110 | CString str(e.what()); 111 | CString str2(to_string(e.get_code()).c_str()); 112 | 113 | str = L"Error: \nCode:" + str2 + L"\n\nMessage: " + str; 114 | MessageBox(dlg, str, L"Error", MB_OK | MB_ICONWARNING); 115 | return FALSE; 116 | } 117 | } 118 | 119 | //check if we have to try to create a new config-file with all params + changed ones 120 | if (cs_cmd_param == L"--create-config") 121 | { 122 | HWLSaveEdit::HWLConfig hwlc_tmp_config = HWLSaveEdit::HWLConfig(); 123 | 124 | try 125 | { 126 | hwlc_tmp_config.write_config(); 127 | MessageBox(dlg, CString("A new config, with all current parameters, was created successfully."), L"Information", MB_OK | MB_ICONINFORMATION); 128 | return FALSE; 129 | } 130 | catch (HWLSaveEdit::HWLException &e) 131 | { 132 | CString str(e.what()); 133 | CString str2(to_string(e.get_code()).c_str()); 134 | 135 | str = L"Error: \nCode:" + str2 + L"\n\nMessage: " + str; 136 | MessageBox(dlg, str, L"Error", MB_OK | MB_ICONWARNING); 137 | return FALSE; 138 | } 139 | } 140 | 141 | //check if we have NOT the commnad-line for update-checking 142 | if (!b_is_update_check) 143 | { 144 | //own initialization 145 | try 146 | { 147 | this->save = new HWLSaveEdit::HWLSaveEditor(); 148 | 149 | if (stoi(this->save->get_config()->get_param_value("openLastSaveFileOnStart", this->save->get_config()->get_sectionID("General"))) == 0) 150 | { 151 | if (MessageBox(dlg, L"Found a 'zmha.bin' within this dir. Open it?", L"Information", MB_YESNO | MB_ICONASTERISK) == IDNO) 152 | this->save = nullptr; 153 | } 154 | 155 | } 156 | catch (HWLSaveEdit::HWLException &e) 157 | { 158 | 159 | CString str(e.what()); 160 | str = L"An error occured: \n" + str + L"\n\nShould Application start with no SaveFile opened?"; 161 | 162 | if (MessageBox(dlg, str, L"Information", MB_YESNO | MB_ICONASTERISK) == IDNO) 163 | return FALSE; 164 | } 165 | 166 | if (save != nullptr && save->get_update_message() != "") 167 | MessageBox(dlg, CString(save->get_update_message().c_str()), L"Information", MB_OK | MB_ICONINFORMATION); 168 | 169 | m_pMainWnd = &dlg; 170 | nResponse = dlg.DoModal(); 171 | 172 | } 173 | else{ 174 | CZeldaCheckForUpdatesDlg dlg_update; 175 | m_pMainWnd = &dlg_update; 176 | nResponse = dlg_update.DoModal(); 177 | 178 | } 179 | 180 | if (nResponse == IDOK) 181 | { 182 | // TODO: Place code here to handle when the dialog is 183 | // dismissed with OK 184 | } 185 | else if (nResponse == IDCANCEL) 186 | { 187 | // TODO: Place code here to handle when the dialog is 188 | // dismissed with Cancel 189 | } 190 | else if (nResponse == -1) 191 | { 192 | TRACE(traceAppMsg, 0, "Warning: dialog creation failed, so application is terminating unexpectedly.\n"); 193 | TRACE(traceAppMsg, 0, "Warning: if you are using MFC controls on the dialog, you cannot #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS.\n"); 194 | } 195 | 196 | // Delete the shell manager created above. 197 | if (pShellManager != NULL) 198 | { 199 | delete pShellManager; 200 | } 201 | 202 | // Since the dialog has been closed, return FALSE so that we exit the 203 | // application, rather than start the application's message pump. 204 | return FALSE; 205 | } 206 | 207 | void CZeldaHWLSaveEditorGUIApp::calc_disabled_MenuItems(CMenu *cm_menu_edit) 208 | { 209 | //check if the static map is empty 210 | if (!mib_disabled_adventure_maps.empty()) 211 | { 212 | //get the ID of the first MAP->Menu-Item 213 | int i_first_map_id = ID_MENU_EDIT_AM_AVMAP; 214 | 215 | //get the AM-SubeMenu 216 | CMenu *cm_menu_edit_am_maps = cm_menu_edit->GetSubMenu(4); 217 | 218 | //iterate over the static-map 219 | for (int i = 0; i < mib_disabled_adventure_maps.size(); i++) 220 | { 221 | //check, if the map is disabled and remove the Item, if its TRUE 222 | if (mib_disabled_adventure_maps[i]) 223 | cm_menu_edit_am_maps->EnableMenuItem(i_first_map_id + i, MF_GRAYED | MF_BYCOMMAND); 224 | else 225 | cm_menu_edit_am_maps->EnableMenuItem(i_first_map_id + i, MF_ENABLED | MF_BYCOMMAND); 226 | 227 | } 228 | } 229 | } -------------------------------------------------------------------------------- /source/gui/ZeldaHWLSaveEditorGUI.h: -------------------------------------------------------------------------------- 1 | 2 | // ZeldaHWLSaveEditorGUI.h : main header file for the PROJECT_NAME application 3 | // 4 | 5 | #pragma once 6 | 7 | #ifndef __AFXWIN_H__ 8 | #error "include 'stdafx.h' before including this file for PCH" 9 | #endif 10 | 11 | #include "resource.h" // main symbols 12 | 13 | #include "ZeldaAboutDlg.h" 14 | #include "ZeldaCheckForUpdatesDlg.h" 15 | #include "ZeldaEditCharaStatsDlg.h" 16 | #include "ZeldaEditGeneralDlg.h" 17 | #include "ZeldaEditMaterials.h" 18 | #include "ZeldaEditFairyFoods.h" 19 | #include "ZeldaEditAdventureModeMaps.h" 20 | #include "ZeldaEditFairyDlg.h" 21 | #include "ZeldaEditCharaWeaponsDlg.h" 22 | #include "ZeldaEditCharaOverviewDlg.h" 23 | #include "ZeldaConfigWeaponCopyDlg.h" 24 | 25 | // CZeldaHWLSaveEditorGUIApp: 26 | // See ZeldaHWLSaveEditorGUI.cpp for the implementation of this class 27 | // 28 | 29 | class CZeldaHWLSaveEditorGUIApp : public CWinApp 30 | { 31 | public: 32 | CZeldaHWLSaveEditorGUIApp(); 33 | 34 | static HWLSaveEdit::HWLSaveEditor* save; 35 | static std::shared_ptr sp_weapon_copy; 36 | 37 | static map mib_disabled_adventure_maps; 38 | static map mib_config_copy_weapon_values; 39 | 40 | static void calc_disabled_MenuItems(CMenu *cm_menu_edit); 41 | 42 | // Overrides 43 | public: 44 | virtual BOOL InitInstance(); 45 | 46 | // Implementation 47 | 48 | DECLARE_MESSAGE_MAP() 49 | }; 50 | 51 | extern CZeldaHWLSaveEditorGUIApp theApp; -------------------------------------------------------------------------------- /source/gui/ZeldaHWLSaveEditorGUI.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedron92/HWL-SaveEditor/4259e42b4ee6d643859fc218e436c20c337cb358/source/gui/ZeldaHWLSaveEditorGUI.rc -------------------------------------------------------------------------------- /source/gui/res/ZeldaHWLSaveEditorGUI.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedron92/HWL-SaveEditor/4259e42b4ee6d643859fc218e436c20c337cb358/source/gui/res/ZeldaHWLSaveEditorGUI.rc2 -------------------------------------------------------------------------------- /source/gui/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedron92/HWL-SaveEditor/4259e42b4ee6d643859fc218e436c20c337cb358/source/gui/resource.h -------------------------------------------------------------------------------- /source/gui/stdafx.cpp: -------------------------------------------------------------------------------- 1 | 2 | // stdafx.cpp : source file that includes just the standard includes 3 | // ZeldaHWLSaveEditorGUI.pch will be the pre-compiled header 4 | // stdafx.obj will contain the pre-compiled type information 5 | 6 | #include "stdafx.h" 7 | 8 | 9 | -------------------------------------------------------------------------------- /source/gui/stdafx.h: -------------------------------------------------------------------------------- 1 | 2 | // stdafx.h : include file for standard system include files, 3 | // or project specific include files that are used frequently, 4 | // but are changed infrequently 5 | 6 | #pragma once 7 | 8 | #ifndef VC_EXTRALEAN 9 | #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers 10 | #endif 11 | 12 | #include "targetver.h" 13 | 14 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit 15 | 16 | // turns off MFC's hiding of some common and often safely ignored warning messages 17 | #define _AFX_ALL_WARNINGS 18 | 19 | #include // MFC core and standard components 20 | #include // MFC extensions 21 | 22 | 23 | #include // MFC Automation classes 24 | 25 | 26 | 27 | #ifndef _AFX_NO_OLE_SUPPORT 28 | #include // MFC support for Internet Explorer 4 Common Controls 29 | #endif 30 | #ifndef _AFX_NO_AFXCMN_SUPPORT 31 | #include // MFC support for Windows Common Controls 32 | #endif // _AFX_NO_AFXCMN_SUPPORT 33 | 34 | #include // MFC support for ribbons and control bars 35 | 36 | #ifndef HWL_SAVE_EDITOR 37 | #define HWL_SAVE_EDITOR 38 | #include "../core/HWLSaveEditor.h" // HWLSaveEditor api 39 | #endif 40 | 41 | 42 | 43 | 44 | 45 | 46 | #ifdef _UNICODE 47 | #if defined _M_IX86 48 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") 49 | #elif defined _M_X64 50 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") 51 | #else 52 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 53 | #endif 54 | #endif 55 | 56 | 57 | -------------------------------------------------------------------------------- /source/gui/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /source/libs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #add all needed-subdirs 2 | 3 | #HTTP-Client subdirs 4 | add_subdirectory(HTTP_Client) 5 | 6 | -------------------------------------------------------------------------------- /source/libs/HTTP_Client/API/HTTPClientAuth.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HTTP_CLIENT_AUTH_H 3 | #define HTTP_CLIENT_AUTH_H 4 | 5 | #include "HTTPClientWrapper.h" // Cross platform support 6 | 7 | 8 | #define HASHLEN 16 9 | #define HASHHEXLEN 32 10 | #define IN 11 | #define OUT 12 | 13 | typedef char HASH[HASHLEN]; 14 | typedef char HASHHEX[HASHHEXLEN+1]; 15 | typedef unsigned long UINT32; 16 | 17 | // Base 64 Related 18 | #define DECODE64(c) (isascii(c) ? base64val[c] : BAD) 19 | #define BAD -1 20 | 21 | static const char base64digits[] = 22 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 23 | 24 | static const char base64val[] = { 25 | BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, 26 | BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, 27 | BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD, 62, BAD,BAD,BAD, 63, 28 | 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,BAD,BAD, BAD,BAD,BAD,BAD, 29 | BAD, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 30 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,BAD, BAD,BAD,BAD,BAD, 31 | BAD, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 32 | 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,BAD, BAD,BAD,BAD,BAD 33 | }; 34 | 35 | void HTTPBase64Encoder(unsigned char *out, const unsigned char *in, int inlen); 36 | int HTTPBase64Decoder(char *out, const char *in); 37 | 38 | 39 | // Digest Related 40 | // Generates a 32 byte random hexadecimal string such as "4f6ba982..." 41 | void HTTPDigestGenerateCNonce(char *outbuff); 42 | 43 | // Calculate H(A1) as per HTTP Digest spec 44 | void HTTPDigestCalcHA1( 45 | IN int nAlg, /* 0 = MD5, 1 = MD5-Sess */ 46 | IN char * pszUserName, 47 | IN char * pszRealm, 48 | IN int nRealmLength, 49 | IN char * pszPassword, 50 | IN char * pszNonce, 51 | IN int nNonceLength, 52 | IN char * pszCNonce, 53 | OUT HASHHEX SessionKey 54 | ); 55 | 56 | // Calculate request-digest/response-digest as per HTTP Digest spec 57 | void HTTPDigestCalcResponse( 58 | IN HASHHEX HA1, // H(A1) 59 | IN char * pszNonce, // nonce from server 60 | IN int nNonceLength, // Length of nonce 61 | IN char * pszNonceCount, // 8 hex digits 62 | IN char * pszCNonce, // client nonce 63 | IN char * pszQop, // qop-value: "", "auth", "auth-int" 64 | IN int nQopLength, // qop param length 65 | IN char * pszMethod, // method from the request 66 | IN char * pszDigestUri, // requested URL 67 | IN int nDigestUriLebgth, // Uri Length 68 | IN HASHHEX HEntity, // H(entity body) if qop="auth-int" 69 | OUT HASHHEX Response // request-digest or response-digest 70 | ); 71 | 72 | // MD5 structures and functions 73 | struct MD5Context 74 | { 75 | long unsigned int buf[4]; 76 | long unsigned int bits[2]; 77 | unsigned char in[64]; 78 | }; 79 | 80 | void HTTPMD5Init (struct MD5Context *context); 81 | void HTTPMD5Update (struct MD5Context *context, unsigned char const *buf,unsigned len); 82 | void HTTPMD5Final (unsigned char digest[16], struct MD5Context *context); 83 | void HTTPMD5Transform (long unsigned int buf[4], long unsigned int const in[16]); 84 | 85 | 86 | // This is needed to make RSAREF happy on some MS-DOS compilers. 87 | typedef struct MD5Context MD5_CTX; 88 | 89 | #endif 90 | 91 | -------------------------------------------------------------------------------- /source/libs/HTTP_Client/API/HTTPClientCommon.h: -------------------------------------------------------------------------------- 1 | 2 | /////////////////////////////////////////////////////////////////////////////// 3 | // 4 | // Module Name: 5 | // CmsiHTTPClientCommon.h 6 | // 7 | // Abstract: Coomon structs and types for the HTTP protocol API 8 | // Author: Eitan Michaelso 9 | // Version: 1.0 10 | // 11 | /////////////////////////////////////////////////////////////////////////////// 12 | 13 | #ifndef _HTTPCLIENT_PROTOCOL_H_ 14 | #define _HTTPCLIENT_PROTOCOL_H_ 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | // Global default sizes 21 | #define HTTP_CLIENT_MAX_URL_LENGTH 512 // Maximum length for an HTTP Url parameter 22 | 23 | // HTTP Session flags (Public flags) 24 | #define HTTP_CLIENT_FLAG_KEEP_ALIVE 0x00000001 // Set the keep alive header 25 | #define HTTP_CLIENT_FLAG_SEND_CHUNKED 0x00000002 // The outgoing should chunked 26 | #define HTTP_CLIENT_FLAG_NO_CACHE 0x00000004 // Set the no cache header 27 | #define HTTP_CLIENT_FLAG_ASYNC 0x00000008 // Currently not implemented 28 | 29 | // HTTP status internal flags 30 | #define HTTP_CLIENT_STATE_PRE_INIT 0x00000000 // Starting stage 31 | #define HTTP_CLIENT_STATE_INIT 0x00000001 // API was initialized (memory was allocated) 32 | #define HTTP_CLIENT_STATE_URL_PARSED 0x00000002 // Url was parsed 33 | #define HTTP_CLIENT_STATE_HOST_CONNECTED 0x00000004 // HEAD verb was sent 34 | #define HTTP_CLIENT_STATE_HEAD_SENT 0x00000008 // Post verb was sent 35 | #define HTTP_CLIENT_STATE_POST_SENT 0x00000010 // HTTP requet was sent 36 | #define HTTP_CLIENT_STATE_REQUEST_SENT 0x00000020 // HTTP request was sent 37 | #define HTTP_CLIENT_STATE_HEADERS_RECIVED 0x00000040 // Headers ware recived from the server 38 | #define HTTP_CLIENT_STATE_HEADERS_PARSED 0x00000080 // HTTP headers ware parsed 39 | #define HTTP_CLIENT_STATE_HEADERS_OK 0x00000100 // Headers status was OK 40 | 41 | // HTTP Return codes 42 | #define HTTP_CLIENT_SUCCESS 0 // HTTP Success status 43 | 44 | #define HTTP_CLIENT_UNKNOWN_ERROR 1 // Unknown error 45 | #define HTTP_CLIENT_ERROR_INVALID_HANDLE 2 // an Invalid handle or possible bad pointer was passed to a function 46 | #define HTTP_CLIENT_ERROR_NO_MEMORY 3 // Buffer too small or a failure while in memory allocation 47 | #define HTTP_CLIENT_ERROR_SOCKET_INVALID 4 // an attempt to use an invalid socket handle was made 48 | #define HTTP_CLIENT_ERROR_SOCKET_CANT_SET 5 // Can't send socket parameters 49 | #define HTTP_CLIENT_ERROR_SOCKET_RESOLVE 6 // Error while resolving host name 50 | #define HTTP_CLIENT_ERROR_SOCKET_CONNECT 7 // Error while connecting to the remote server 51 | #define HTTP_CLIENT_ERROR_SOCKET_TIME_OUT 8 // socket time out error 52 | #define HTTP_CLIENT_ERROR_SOCKET_RECV 9 // Error while receiving data 53 | #define HTTP_CLIENT_ERROR_SOCKET_SEND 10 // Error while sending data 54 | #define HTTP_CLIENT_ERROR_HEADER_RECV 11 // Error while receiving the remote HTTP headers 55 | #define HTTP_CLIENT_ERROR_HEADER_NOT_FOUND 12 // Could not find element within header 56 | #define HTTP_CLIENT_ERROR_HEADER_BIG_CLUE 13 // The headers search clue was too large for the internal API buffer 57 | #define HTTP_CLIENT_ERROR_HEADER_NO_LENGTH 14 // No content length was specified for the outgoing data. the caller should specify chunking mode in the session creation 58 | #define HTTP_CLIENT_ERROR_CHUNK_TOO_BIG 15 // The HTTP chunk token that was received from the server was too big and possibly wrong 59 | #define HTTP_CLIENT_ERROR_AUTH_HOST 16 // Could not authenticate with the remote host 60 | #define HTTP_CLIENT_ERROR_AUTH_PROXY 17 // Could not authenticate with the remote proxy 61 | #define HTTP_CLIENT_ERROR_BAD_VERB 18 // Bad or not supported HTTP verb was passed to a function 62 | #define HTTP_CLIENT_ERROR_LONG_INPUT 19 // a function received a parameter that was too large 63 | #define HTTP_CLIENT_ERROR_BAD_STATE 20 // The session state prevents the current function from proceeding 64 | #define HTTP_CLIENT_ERROR_CHUNK 21 // Could not parse the chunk length while in chunked transfer 65 | #define HTTP_CLIENT_ERROR_BAD_URL 22 // Could not parse curtail elements from the URL (such as the host name, HTTP prefix act') 66 | #define HTTP_CLIENT_ERROR_BAD_HEADER 23 // Could not detect key elements in the received headers 67 | #define HTTP_CLIENT_ERROR_BUFFER_RSIZE 24 // Error while attempting to resize a buffer 68 | #define HTTP_CLIENT_ERROR_BAD_AUTH 25 // Authentication schema is not supported 69 | #define HTTP_CLIENT_ERROR_AUTH_MISMATCH 26 // The selected authentication schema does not match the server response 70 | #define HTTP_CLIENT_ERROR_NO_DIGEST_TOKEN 27 // an element was missing while parsing the digest authentication challenge 71 | #define HTTP_CLIENT_ERROR_NO_DIGEST_ALG 28 // Digest algorithem could be MD5 or MD5-sess other types are not supported 72 | #define HTTP_CLIENT_ERROR_SOCKET_BIND 29 // Binding error 73 | #define HTTP_CLIENT_ERROR_TLS_NEGO 30 // Tls negotiation error 74 | #define HTTP_CLIENT_ERROR_NOT_IMPLEMENTED 64 // Feature is not (yet) implemented 75 | #define HTTP_CLIENT_EOS 1000 // HTTP end of stream message 76 | 77 | /////////////////////////////////////////////////////////////////////////////// 78 | // 79 | // Section : HTTP API structures 80 | // Last updated : 01/09/2005 81 | // 82 | /////////////////////////////////////////////////////////////////////////////// 83 | 84 | // HTTP Supported authentication methods 85 | typedef enum _HTTP_AUTH_SCHEMA 86 | { 87 | AuthSchemaNone = 0, 88 | AuthSchemaBasic, 89 | AuthSchemaDigest, 90 | AuthSchemaKerberos, 91 | AuthNotSupported 92 | 93 | } HTTP_AUTH_SCHEMA; 94 | 95 | // HTTP supported verbs 96 | typedef enum _HTTP_VERB 97 | { 98 | VerbGet = 0, 99 | VerbHead, 100 | VerbPost, 101 | VerbNotSupported 102 | // Note: others verb such as connect and put are currently not supported 103 | 104 | } HTTP_VERB; 105 | 106 | // Data structure that the caller can request at any time that will include some information regarding the session 107 | typedef struct _HTTP_CLIENT 108 | { 109 | long unsigned int HTTPStatusCode; // HTTP Status code (200 OK) 110 | long unsigned int RequestBodyLengthSent; // Total bytes sent (body only) 111 | long unsigned int ResponseBodyLengthReceived; // Total bytes received (body only) 112 | long unsigned int TotalResponseBodyLength; // as extracted from the �content-length" header 113 | long unsigned int HttpState; 114 | } HTTP_CLIENT; 115 | 116 | 117 | #endif // _HTTPCLIENT_PROTOCOL_H_ 118 | #ifdef __cplusplus 119 | } 120 | #endif -------------------------------------------------------------------------------- /source/libs/HTTP_Client/API/HTTPClientString.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _HTTP_CLIENT_STRING 3 | #define _HTTP_CLIENT_STRING 4 | 5 | #include "HTTPClientWrapper.h" // Cross platform support 6 | #include "HTTPClient.h" 7 | 8 | /////////////////////////////////////////////////////////////////////////////// 9 | // 10 | // Section : HTTP Api global definitions 11 | // Last updated : 01/09/2005 12 | // 13 | /////////////////////////////////////////////////////////////////////////////// 14 | 15 | BOOL HTTPStrInsensitiveCompare (CHAR *pSrc, CHAR* pDest, long unsigned int nLength); 16 | BOOL HTTPStrSearch (CHAR *pSrc, CHAR *pSearched, long unsigned int nOffset, long unsigned int nScope,HTTP_PARAM *HttpParam); 17 | CHAR HTTPStrExtract (CHAR *pParam,long unsigned int nOffset,CHAR Restore); 18 | CHAR* HTTPStrCaseStr (CHAR *pSrc, long unsigned int nSrcLength, CHAR *pFind); 19 | CHAR* HTTPStrGetToken (CHAR *pSrc, long unsigned int nSrcLength, CHAR *pDest, long unsigned int *nDestLength); 20 | long unsigned int HTTPStrGetDigestToken (HTTP_PARAM pParamSrc, CHAR *pSearched, HTTP_PARAM *pParamDest); 21 | long unsigned int HTTPStrHToL (CHAR * s); 22 | CHAR* HTTPStrLToH (CHAR * dest,long unsigned int nSrc); 23 | #endif 24 | -------------------------------------------------------------------------------- /source/libs/HTTP_Client/API/HTTPClientWrapper.c: -------------------------------------------------------------------------------- 1 | 2 | #include "HTTPClientWrapper.h" 3 | 4 | 5 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 6 | // 7 | // Section : Stdc: HTTPWrapperIsAscii 8 | // Last updated : 15/05/2005 9 | // Notes : Same as stdc: isascii 10 | // 11 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 12 | 13 | int HTTPWrapperIsAscii(int c) 14 | { 15 | return (!(c & ~0177)); 16 | } 17 | 18 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 19 | // 20 | // Section : Stdc: HTTPWrapperToUpper 21 | // Last updated : 15/05/2005 22 | // Notes : Convert character to uppercase. 23 | // 24 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 25 | 26 | int HTTPWrapperToUpper(int c) 27 | { 28 | // -32 29 | if(HTTPWrapperIsAscii(c) > 0) 30 | { 31 | if(c >= 97 && c <= 122) 32 | { 33 | return (c - 32); 34 | } 35 | } 36 | 37 | return c; 38 | } 39 | 40 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 41 | // 42 | // Section : Stdc: HTTPWrapperToLower 43 | // Last updated : 13/06/2006 44 | // Notes : Convert character to lowercase. 45 | // 46 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 47 | 48 | int HTTPWrapperToLower(int c) 49 | { 50 | // +32 51 | if(HTTPWrapperIsAscii(c) > 0) 52 | { 53 | if(c >= 65 && c <= 90) 54 | { 55 | return (c + 32); 56 | } 57 | } 58 | 59 | return c; 60 | } 61 | 62 | 63 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 64 | // 65 | // Section : Stdc: isalpha 66 | // Last updated : 15/05/2005 67 | // Notes : returns nonzero if c is a particular representation of an alphabetic character 68 | // 69 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 70 | 71 | int HTTPWrapperIsAlpha(int c) 72 | { 73 | 74 | if(HTTPWrapperIsAscii(c) > 0) 75 | { 76 | if( (c >= 97 && c <= 122) || (c >= 65 && c <= 90)) 77 | { 78 | return c; 79 | } 80 | } 81 | return 0; 82 | } 83 | 84 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 85 | // 86 | // Section : Stdc: isalnum 87 | // Last updated : 15/05/2005 88 | // Notes : returns nonzero if c is a particular representation of an alphanumeric character 89 | // 90 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 91 | 92 | int HTTPWrapperIsAlNum(int c) 93 | { 94 | if(HTTPWrapperIsAscii(c) > 0) 95 | { 96 | 97 | if(HTTPWrapperIsAlpha(c) > 0) 98 | { 99 | return c; 100 | } 101 | 102 | if( c >= 48 && c <= 57) 103 | { 104 | return c; 105 | } 106 | 107 | } 108 | return 0; 109 | } 110 | 111 | 112 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 113 | // 114 | // Section : HTTPWrapper_itoa 115 | // Last updated : 15/05/2005 116 | // Notes : same as stdc itoa() // hmm.. allmost the same 117 | // 118 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 119 | 120 | char* HTTPWrapperItoa(char *s,int a) 121 | { 122 | unsigned int b; 123 | 124 | if(a > 2147483647) 125 | { 126 | return 0; // overflow 127 | } 128 | 129 | if (a < 0) b = -a, *s++ = '-'; 130 | else b = a; 131 | for(;a;a=a/10) s++; 132 | for(*s='\0';b;b=b/10) *--s=b%10+'0'; 133 | return s; 134 | } 135 | 136 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 137 | // 138 | // Section : HTTPWrapper_ShutDown 139 | // Last updated : 15/05/2005 140 | // Notes : Handles parameter changes in the socket shutdown() 141 | // 142 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 143 | 144 | int HTTPWrapperShutDown (int s,int how) 145 | { 146 | return shutdown(s,how); 147 | } 148 | 149 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 150 | // 151 | // Section : HTTPWrapper_GetSocketError 152 | // Last updated : 15/05/2005 153 | // Notes : WSAGetLastError Wrapper (Win32 Specific) 154 | // 155 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 156 | 157 | int HTTPWrapperGetSocketError (int s) 158 | { 159 | #ifdef _WIN32 160 | return WSAGetLastError(); 161 | #else 162 | return errno; 163 | #endif 164 | } 165 | 166 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 167 | // 168 | // Section : HTTPWrapper_GetHostByName 169 | // Last updated : 15/05/2005 170 | // Notes : gethostbyname for Win32 171 | // 172 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 173 | 174 | unsigned long HTTPWrapperGetHostByName(char *name,unsigned long *address) 175 | { 176 | HTTP_HOSTNET *HostEntry; 177 | int iPos = 0, iLen = 0,iNumPos = 0,iDots =0; 178 | long iIPElement; 179 | char c = 0; 180 | char Num[4]; 181 | int iHostType = 0; // 0 : numeric IP 182 | 183 | // Check if the name is an IP or host 184 | iLen = strlen(name); 185 | for(iPos = 0; iPos <= iLen;iPos++) 186 | { 187 | c = name[iPos]; 188 | if((c >= 48 && c <= 57) || (c == '.') ) 189 | { 190 | // c is numeric or dot 191 | if(c != '.') 192 | { 193 | // c is numeric 194 | if(iNumPos > 3) 195 | { 196 | iHostType++; 197 | break; 198 | } 199 | Num[iNumPos] = c; 200 | Num[iNumPos + 1] = 0; 201 | iNumPos ++; 202 | } 203 | else 204 | { 205 | iNumPos = 0; 206 | iDots++; 207 | iIPElement = atol(Num); 208 | if(iIPElement > 256 || iDots > 3) 209 | { 210 | return 0; // error invalid IP 211 | } 212 | } 213 | } 214 | else 215 | { 216 | break; // this is an alpha numeric address type 217 | } 218 | } 219 | 220 | if(c == 0 && iHostType == 0 && iDots == 3) 221 | { 222 | iIPElement = atol(Num); 223 | if(iIPElement > 256) 224 | { 225 | return 0; // error invalid IP 226 | } 227 | } 228 | else 229 | { 230 | iHostType++; 231 | } 232 | 233 | if(iHostType > 0) 234 | { 235 | 236 | HostEntry = gethostbyname(name); 237 | if(HostEntry) 238 | { 239 | *(address) = *((u_long*)HostEntry->h_addr_list[0]); 240 | 241 | //*(address) = (unsigned long)HostEntry->h_addr_list[0]; 242 | return 1; // Error 243 | } 244 | else 245 | { 246 | return 0; // OK 247 | } 248 | } 249 | 250 | else // numeric address - no need for DNS resolve 251 | { 252 | *(address) = inet_addr(name); 253 | return 1; 254 | 255 | } 256 | return 0; 257 | } 258 | 259 | 260 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 261 | // 262 | // Section : HTTPWrapper_GetRandomeNumber 263 | // Last updated : 15/05/2005 264 | // Notes : GetRandom number for Win32 265 | // 266 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 267 | 268 | void HTTPWrapperInitRandomeNumber() 269 | { 270 | srand((unsigned int)time(NULL)); 271 | } 272 | 273 | int HTTPWrapperGetRandomeNumber() 274 | { 275 | int num; 276 | num = (int)(((double) rand()/ ((double)RAND_MAX+1)) * 16); 277 | return num; 278 | } 279 | 280 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 281 | // 282 | // Section : HTTPWrapper_GetRTC 283 | // Last updated : 15/05/2005 284 | // Author Name : Eitan Michaelson 285 | // Notes : Get uptime under Win32 & AMT 286 | // 287 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 288 | 289 | long HTTPWrapperGetUpTime() 290 | { 291 | #ifdef _WIN32 292 | 293 | long lTime = 0; 294 | 295 | lTime = (GetTickCount() / CLOCKS_PER_SEC); 296 | return lTime; 297 | 298 | #else 299 | 300 | struct timespec tp; 301 | 302 | clock_gettime(CLOCK_MONOTONIC , &tp); 303 | return tp.tv_sec; 304 | 305 | #endif 306 | } 307 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 308 | // 309 | // Section : TSL Wrapper 310 | // Last updated : 15/05/2005 311 | // Notes : HTTPWrapper_Sec_Connect 312 | // 313 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 314 | 315 | int HTTPWrapperSSLConnect(int s,const struct sockaddr *name,int namelen,char *hostname) 316 | { 317 | return -1; 318 | } 319 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 320 | 321 | int HTTPWrapperSSLNegotiate(int s,const struct sockaddr *name,int namelen,char *hostname) 322 | { 323 | return -1; 324 | } 325 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 326 | 327 | int HTTPWrapperSSLSend(int s,char *buf, int len,int flags) 328 | { 329 | return -1; 330 | } 331 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 332 | 333 | int HTTPWrapperSSLRecv(int s,char *buf, int len,int flags) 334 | { 335 | return -1; 336 | } 337 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 338 | int HTTPWrapperSSLRecvPending(int s) 339 | { 340 | return -1; 341 | } 342 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 343 | int HTTPWrapperSSLClose(int s) 344 | { 345 | return -1; 346 | 347 | } 348 | -------------------------------------------------------------------------------- /source/libs/HTTP_Client/API/HTTPClientWrapper.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HTTP_CLIENT_WRAPPER 3 | #define HTTP_CLIENT_WRAPPER 4 | 5 | 6 | /////////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Section : Microsoft Windows Support 9 | // Last updated : 01/09/2005 10 | // 11 | /////////////////////////////////////////////////////////////////////////////// 12 | 13 | #ifdef _WIN32 14 | 15 | #pragma warning (disable: 4996) // 'function': was declared deprecated (VS 2005) 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | // Sockets (Winsock wrapper) 25 | #define HTTP_ECONNRESET (WSAECONNRESET) 26 | #define HTTP_EINPROGRESS (WSAEINPROGRESS) 27 | #define HTTP_EWOULDBLOCK (WSAEWOULDBLOCK) 28 | 29 | // Kluge alert: redefining strncasecmp() as memicmp() for Windows. 30 | // 31 | #define strncasecmp memicmp 32 | #define strcasecmp stricmp 33 | 34 | #else // Non Win32 : GCC Linux 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | 54 | #define SOCKET_ERROR -1 55 | 56 | // Sockets (Winsock wrapper) 57 | #define HTTP_EINPROGRESS (EINPROGRESS) 58 | #define HTTP_EWOULDBLOCK (EWOULDBLOCK) 59 | 60 | // Generic types 61 | typedef unsigned long UINT32; 62 | typedef long INT32; 63 | 64 | #endif // #ifdef _HTTP_BUILD_WIN32 65 | 66 | // Note: define this to prevent timeouts while debugging. 67 | // #define NO_TIMEOUTS 68 | 69 | /////////////////////////////////////////////////////////////////////////////// 70 | // 71 | // Section : Functions that are not supported by the AMT stdc framework 72 | // So they had to be specificaly added. 73 | // Last updated : 01/09/2005 74 | // 75 | /////////////////////////////////////////////////////////////////////////////// 76 | #ifdef __cplusplus 77 | extern "C" { 78 | #endif 79 | 80 | // STDC Wrapper implimentation 81 | int HTTPWrapperIsAscii (int c); 82 | int HTTPWrapperToUpper (int c); 83 | int HTTPWrapperToLower (int c); 84 | int HTTPWrapperIsAlpha (int c); 85 | int HTTPWrapperIsAlNum (int c); 86 | char* HTTPWrapperItoa (char *buff,int i); 87 | void HTTPWrapperInitRandomeNumber (); 88 | long HTTPWrapperGetUpTime (); 89 | int HTTPWrapperGetRandomeNumber (); 90 | int HTTPWrapperGetSocketError (int s); 91 | unsigned long HTTPWrapperGetHostByName (char *name,unsigned long *address); 92 | int HTTPWrapperShutDown (int s,int in); 93 | // SSL Wrapper prototypes 94 | int HTTPWrapperSSLConnect (int s,const struct sockaddr *name,int namelen,char *hostname); 95 | int HTTPWrapperSSLNegotiate (int s,const struct sockaddr *name,int namelen,char *hostname); 96 | int HTTPWrapperSSLSend (int s,char *buf, int len,int flags); 97 | int HTTPWrapperSSLRecv (int s,char *buf, int len,int flags); 98 | int HTTPWrapperSSLClose (int s); 99 | int HTTPWrapperSSLRecvPending (int s); 100 | // Global wrapper Functions 101 | #define IToA HTTPWrapperItoa 102 | #define GetUpTime HTTPWrapperGetUpTime 103 | #define SocketGetErr HTTPWrapperGetSocketError 104 | #define HostByName HTTPWrapperGetHostByName 105 | #define InitRandomeNumber HTTPWrapperInitRandomeNumber 106 | #define GetRandomeNumber HTTPWrapperGetRandomeNumber 107 | 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | 112 | /////////////////////////////////////////////////////////////////////////////// 113 | // 114 | // Section : Global type definitions 115 | // Last updated : 01/09/2005 116 | // 117 | /////////////////////////////////////////////////////////////////////////////// 118 | 119 | #define VOID void 120 | #ifndef NULL 121 | #define NULL 0 122 | #endif 123 | #define TRUE 1 124 | #define FALSE 0 125 | typedef char CHAR; 126 | typedef unsigned short UINT16; 127 | typedef int BOOL; 128 | //typedef unsigned long ULONG; 129 | 130 | // Global socket structures and definitions 131 | #define HTTP_INVALID_SOCKET (-1) 132 | typedef struct sockaddr_in HTTP_SOCKADDR_IN; 133 | typedef struct timeval HTTP_TIMEVAL; 134 | typedef struct hostent HTTP_HOSTNET; 135 | typedef struct sockaddr HTTP_SOCKADDR; 136 | typedef struct in_addr HTTP_INADDR; 137 | 138 | 139 | #endif // HTTP_CLIENT_WRAPPER 140 | -------------------------------------------------------------------------------- /source/libs/HTTP_Client/CHTTP_Client.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | * @desc: C++ - Wrapper with code from the original example. See License.txt for more information 4 | */ 5 | //include needed and correct header-files 6 | #include 7 | #include "CHTTP_Client.h" 8 | 9 | /** 10 | * The defined constructor. 11 | * It will initialize the needed data with the current values of the class. 12 | * If we have an given url, it will set it instead of the hardcoded one 13 | * 14 | * @var string s_url the url as a string 15 | * 16 | */ 17 | HTTP_Client::HTTP_Client(string s_url, bool b_useProxy, string s_proxyHost, int i_proxyPort) 18 | { 19 | //check if we have a given and not empty url 20 | if (s_url != "") 21 | this->s_current_url = s_url; 22 | 23 | //check if we should use the proxy and set it 24 | if (b_useProxy) 25 | { 26 | this->b_use_proxy = b_useProxy; 27 | this->s_http_proxy_host = s_proxyHost; 28 | this->i_http_proxy_port = i_proxyPort; 29 | } 30 | 31 | memset(&this->o_request_parameters, 0, sizeof(HTTPParameters)); 32 | this->init(); 33 | } 34 | 35 | /** 36 | * Only the initialization of the normal-destructor 37 | */ 38 | HTTP_Client::~HTTP_Client() 39 | { 40 | } 41 | 42 | 43 | 44 | /** 45 | * This method will initialize all needed data with the current class-values 46 | * and also do OS-specific call (WIN32) if needed 47 | * 48 | */ 49 | void HTTP_Client::init() 50 | { 51 | //url, default nothing special 52 | strcpy(this->o_request_parameters.Uri, this->s_current_url.c_str()); 53 | 54 | //proxy 55 | this->o_request_parameters.UseProxy = this->b_use_proxy; 56 | strcpy(this->o_request_parameters.ProxyHost, this->s_http_proxy_host.c_str()); 57 | this->o_request_parameters.ProxyPort = this->i_http_proxy_port; 58 | 59 | //auth..not implemented yet 60 | strcpy(this->o_request_parameters.UserName, this->s_http_auth_name.c_str()); 61 | strcpy(this->o_request_parameters.Password, this->s_http_auth_password.c_str()); 62 | this->o_request_parameters.AuthType = AuthSchemaNone; 63 | 64 | #ifdef _WIN32 65 | // OS specific call to start Winsock 66 | HTTPOSInit(1); 67 | #endif 68 | } 69 | 70 | 71 | 72 | /** 73 | * This method return the current url 74 | * 75 | * @return string the current url to send the http-request 76 | * 77 | */ 78 | string HTTP_Client::get_current_url() 79 | { 80 | return this->s_current_url; 81 | } 82 | 83 | /** 84 | * This method return the current proxy-settings as a string 85 | * but only if we really use a proxy. 86 | * 87 | * @return string the current proxy-settings (Host:port) 88 | * 89 | */ 90 | string HTTP_Client::get_current_proxy() 91 | { 92 | if (this->b_use_proxy) 93 | { 94 | return (this->s_http_proxy_host + ":" + to_string(this->i_http_proxy_port)); 95 | } 96 | else 97 | { 98 | return ""; 99 | } 100 | 101 | } 102 | 103 | /** 104 | * This method return the current output. At default the variable is empty, but after 105 | * an successfull request it has the output of the request itself. 106 | * 107 | * @return string the current output (after successfull sending) 108 | * 109 | */ 110 | string HTTP_Client::get_current_output() 111 | { 112 | return this->s_http_result; 113 | } 114 | 115 | 116 | 117 | /** 118 | * This method set the current url for an http-request 119 | * 120 | * @var string s_url the url as a string 121 | * 122 | */ 123 | void HTTP_Client::set_current_url(string s_url) 124 | { 125 | this->s_current_url = s_url; 126 | this->init(); 127 | } 128 | 129 | /** 130 | * This method set the current proxy for an http-request 131 | * 132 | * @var string s_proxyHost the proxyHost 133 | * @var int i_proxyPort the proxyPort 134 | * 135 | */ 136 | void HTTP_Client::set_current_proxy(string s_proxyHost, int i_proxyPort) 137 | { 138 | this->s_http_proxy_host = s_proxyHost; 139 | this->i_http_proxy_port = i_proxyPort; 140 | this->init(); 141 | } 142 | 143 | /** 144 | * This method change the state, if the proxy-server is used or not 145 | * 146 | * @var bool b_use_proxy state, if we have to use the proxy-settings 147 | * 148 | */ 149 | void HTTP_Client::use_proxy(bool b_use_proxy) 150 | { 151 | this->b_use_proxy = b_use_proxy; 152 | this->init(); 153 | } 154 | 155 | 156 | 157 | /** 158 | * This method send a http_request (GET-Method) and the returned 159 | * output will send to the internal result-variable. 160 | * 161 | * @todo add error handling 162 | * 163 | */ 164 | void HTTP_Client::send_http_request() 165 | { 166 | //Clean buffer first 167 | strcpy(this->c_http_buffer, ""); 168 | 169 | do 170 | { 171 | // Open the HTTP request handle 172 | this->o_http_session = HTTPClientOpenRequest(0); 173 | 174 | // Use Proxy server 175 | if (this->b_use_proxy) 176 | { 177 | if ((this->i_return_code = HTTPClientSetProxy(this->o_http_session, this->o_request_parameters.ProxyHost, 178 | this->o_request_parameters.ProxyPort, NULL, NULL)) != HTTP_CLIENT_SUCCESS) 179 | { 180 | break; 181 | } 182 | } 183 | 184 | // Send a request for the home page 185 | if ((this->i_return_code = HTTPClientSendRequest(this->o_http_session, this->o_request_parameters.Uri, NULL, 0, FALSE, 0, 0)) != HTTP_CLIENT_SUCCESS) 186 | { 187 | break; 188 | } 189 | 190 | // Retrieve the the headers and analyze them 191 | if ((this->i_return_code = HTTPClientRecvResponse(this->o_http_session, 3)) != HTTP_CLIENT_SUCCESS) 192 | { 193 | break; 194 | } 195 | 196 | // Get the data until we get an error or end of stream code 197 | // printf("Each dot represents %d bytes:\n",HTTP_BUFFER_SIZE ); 198 | while (this->i_return_code == HTTP_CLIENT_SUCCESS || this->i_return_code != HTTP_CLIENT_EOS) 199 | { 200 | // Set the size of our buffer 201 | this->i_size = HTTP_CLIENT_BUFFER_SIZE; 202 | 203 | // Get the data 204 | this->i_return_code = HTTPClientReadData(this->o_http_session, this->c_http_buffer, this->i_size, 0, &this->i_size); 205 | this->i_total_size += this->i_size; 206 | 207 | } 208 | HTTPClientCloseRequest(&this->o_http_session); 209 | } while (0); // Run only once 210 | 211 | //copy buffer to the internal output-string and delete the last newline-character 212 | if (strcmp(this->c_http_buffer, "") != 0) 213 | { 214 | this->s_http_result = this->c_http_buffer; 215 | this->s_http_result.erase(remove(this->s_http_result.begin(), this->s_http_result.end(), '\n'), this->s_http_result.end()); 216 | } 217 | else 218 | this->s_http_result = ""; 219 | 220 | 221 | 222 | //clear buffer 223 | strcpy(this->c_http_buffer, ""); 224 | 225 | } -------------------------------------------------------------------------------- /source/libs/HTTP_Client/CHTTP_Client.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @author: nedron92, 2016 3 | * @desc: C++ - Wrapper with code from the original example. See License.txt for more information 4 | */ 5 | #pragma once 6 | 7 | /* 8 | * You need lib ws2_32.lib to compile 9 | * uncomment these line or link the lib in your options directly 10 | * WIN32 only! 11 | * 12 | */ 13 | //#pragma comment(lib, "ws2_32.lib") 14 | 15 | #ifndef HTTP_CLIENT_CPP 16 | #define HTTP_CLIENT_CPP 17 | 18 | #include 19 | #include "API/HTTPClient.h" 20 | 21 | /* 22 | * Typedef of needed structure (holding the data) 23 | * 24 | */ 25 | typedef struct _HTTPParameters 26 | { 27 | char Uri[1024]; 28 | char ProxyHost[1024]; 29 | unsigned int UseProxy; 30 | unsigned int ProxyPort; 31 | unsigned int Verbose; 32 | char UserName[64]; 33 | char Password[64]; 34 | HTTP_AUTH_SCHEMA AuthType; 35 | 36 | } HTTPParameters; 37 | 38 | #define HTTP_CLIENT_BUFFER_SIZE 8192 39 | 40 | using namespace std; 41 | 42 | class HTTP_Client 43 | { 44 | private: 45 | 46 | /* @var s_current_url the current url for an http-request */ 47 | string s_current_url = ""; 48 | 49 | 50 | /* @var b_use_proxy Toogling if http-request will use an proxy or not */ 51 | bool b_use_proxy = false; 52 | 53 | /* @var s_http_proxy_host the proxy-host */ 54 | string s_http_proxy_host = "0.0.0.0"; 55 | 56 | /* @var i_http_proxy_port the proxy-port */ 57 | unsigned int i_http_proxy_port = 0; 58 | 59 | 60 | /* @var b_use_auth Toogling if http-request will use authentication or not */ 61 | bool b_use_auth = false; 62 | 63 | /* @var s_http_auth_name username for authentication */ 64 | string s_http_auth_name = ""; 65 | 66 | /* @var s_http_auth_password password for authentication */ 67 | string s_http_auth_password = ""; 68 | 69 | /* @var s_http_auth_type type of authentication */ 70 | string s_http_auth_type = ""; 71 | 72 | 73 | /* @var s_http_result hold the current output (after successfull http-request) */ 74 | string s_http_result = ""; 75 | 76 | //import from old example 77 | int i_return_code; 78 | long unsigned int i_size = 0; 79 | long unsigned int i_total_size = 0; 80 | char c_http_buffer[HTTP_CLIENT_BUFFER_SIZE]; 81 | HTTPParameters o_request_parameters; 82 | HTTP_SESSION_HANDLE o_http_session; 83 | 84 | void init(); 85 | 86 | public: 87 | //constructor and destructor 88 | HTTP_Client(string s_url = "", bool b_useProxy = false, string s_proxyHost = "127.0.0.1", int i_proxyPort = 8080); 89 | ~HTTP_Client(); 90 | 91 | //needed getter/setter methods 92 | string get_current_url(); 93 | string get_current_proxy(); 94 | //string get_auth_settings - not implemented yet 95 | string get_current_output(); 96 | 97 | void set_current_url(string s_url); 98 | void set_current_proxy(string s_proxyHost, int i_proxyPort); 99 | void use_proxy(bool b_use_proxy); 100 | //void change_auth_settings - not implemented yet 101 | 102 | //method for sending http-requests 103 | void send_http_request(); 104 | }; 105 | 106 | #endif // HTTP_CLIENT_CPP 107 | -------------------------------------------------------------------------------- /source/libs/HTTP_Client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #add all .cpp files of the core folder to the Variable "HWLSaveSrc" 2 | file(GLOB_RECURSE HTTPClientSrc 3 | "*.c" 4 | "*.cpp" 5 | ) 6 | 7 | #create a static library from core-sources 8 | add_library(http_client STATIC ${HTTPClientSrc}) 9 | -------------------------------------------------------------------------------- /source/libs/HTTP_Client/License.txt: -------------------------------------------------------------------------------- 1 | 2 | HTTPClient 1.1 10 Nov 2014 3 | 4 | Author: Eitan Michaelson: noyasoft@gmail.com 5 | Linux Porting and testing: Bob Wirka: bobwirka@rtcworks.com 6 | 7 | C++ - Class-Wrapper and API-Rewrite, 2016: nedron92: nedron92@googlemail.com 8 | 9 | Original C-Implementation Repo and Download: 10 | https://sourceforge.net/projects/chttpclient/ 11 | 12 | LICENSE 13 | ------- 14 | HTTPClient is distributed under the MIT License: 15 | 16 | Copyright (c) 2006 Eitan Michaelson 17 | 18 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 19 | and associated documentation files (the "Software"), to deal in the Software without restriction, 20 | including without limitation the rights to use, copy, modify, merge, publish, distribute, 21 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished 22 | to do so, subject to the following conditions: 23 | 24 | The above copyright notice and this permission notice shall be included in all copies 25 | or substantial portions of the Software. 26 | 27 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 28 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 30 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 31 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 32 | OTHER DEALINGS IN THE SOFTWARE. 33 | --------------------------------------------------------------------------------