mirror of
https://github.com/geode-sdk/geode.git
synced 2025-04-15 14:34:50 -04:00
Merge a1fca2aa68
into 1b4561c986
This commit is contained in:
commit
a94bd25f4f
1131 changed files with 0 additions and 219261 deletions
.clang-format.git-blame-ignore-revs.gitattributes.gitignoreCHANGELOG.mdCMakeLists.txtCODE_OF_CONDUCT.mdEULALICENSE.txtREADME.mdVERSION
.github
ISSUE_TEMPLATE
actions
build-debug-info-post
build-debug-info
setup-cache
setup-dump-sym
setup-ninja
workflows
cmake
entry.cppflash.tomlinstaller
mac
windows
Graphics
Language Files
CzechExtra.nshEnglishExtra.nshFinnishExtra.nshFrenchExtra.nshGermanExtra.nshGreekExtra.nshJapaneseExtra.nshKoreanExtra.nshPolishExtra.nshPortugueseBRExtra.nshPortugueseExtra.nshRussianExtra.nshSimpChineseExtra.nshSpanishExtra.nshSpanishInternationalExtra.nshSwedishExtra.nshTradChineseExtra.nshTurkishExtra.nshUkrainianExtra.nsh
dl-vcr.ps1installer.nsiloader
CMakeLists.txtREADME.md
hash
include/Geode
Bindings.hppDefaultInclude.hppGeode.hppLoader.hppModify.hppPrelude.hppUI.hppUtils.hpp
c++stl
aliastl.hppgdstdlib.hppgnustl-map.hppgnustl.hpp
gnustl
143
.clang-format
143
.clang-format
|
@ -1,143 +0,0 @@
|
|||
---
|
||||
IndentWidth: 4
|
||||
|
||||
AlignAfterOpenBracket: BlockIndent
|
||||
AlignEscapedNewlines: Left
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignOperands: DontAlign
|
||||
AlignTrailingComments: false
|
||||
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
|
||||
AllowShortBlocksOnASingleLine: Empty
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortLambdasOnASingleLine: Empty
|
||||
|
||||
AllowShortCaseLabelsOnASingleLine: true
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
|
||||
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
|
||||
AlwaysBreakAfterReturnType: None
|
||||
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
|
||||
BinPackArguments: false
|
||||
BinPackParameters: true
|
||||
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: false
|
||||
AfterControlStatement: Never
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: false
|
||||
SplitEmptyNamespace: false
|
||||
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeConceptDeclarations: true
|
||||
BreakBeforeTernaryOperators: false
|
||||
BreakConstructorInitializers: AfterColon
|
||||
BreakInheritanceList: AfterColon
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 100
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
|
||||
DeriveLineEnding: false
|
||||
UseCRLF: false
|
||||
UseTab: Never
|
||||
|
||||
PointerAlignment: Left
|
||||
ReferenceAlignment: Pointer
|
||||
|
||||
EmptyLineBeforeAccessModifier: Always
|
||||
FixNamespaceComments: false
|
||||
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
- Regex: '^".*"'
|
||||
Priority: 1
|
||||
|
||||
- Regex: '^<.*>'
|
||||
Priority: 2
|
||||
|
||||
IndentAccessModifiers: false
|
||||
AccessModifierOffset: -4
|
||||
IndentCaseBlocks: false
|
||||
IndentCaseLabels: true
|
||||
IndentExternBlock: Indent
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: BeforeHash
|
||||
IndentRequiresClause: true
|
||||
IndentWrappedFunctionNames: false
|
||||
# InsertBraces: true
|
||||
InsertTrailingCommas: None
|
||||
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MaxEmptyLinesToKeep: 1
|
||||
LambdaBodyIndentation: Signature
|
||||
NamespaceIndentation: All
|
||||
|
||||
PPIndentWidth: -1
|
||||
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakOpenParenthesis: 0
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 10
|
||||
PenaltyReturnTypeOnItsOwnLine: 1000000
|
||||
PenaltyIndentedWhitespace: 0
|
||||
|
||||
QualifierAlignment: Right
|
||||
|
||||
RequiresClausePosition: OwnLine
|
||||
ReflowComments: true
|
||||
SeparateDefinitionBlocks: Always
|
||||
|
||||
SortIncludes: CaseSensitive
|
||||
SortUsingDeclarations: true
|
||||
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceAroundPointerQualifiers: Default
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: Never
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 1
|
||||
Maximum: -1
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: c++20
|
|
@ -1,6 +0,0 @@
|
|||
# add clang format (#62)
|
||||
11e81e3d64313d319955d9a214ad0ded78985bed
|
||||
2bb416ba77f2f01897cc10a1afac40c957feadfc
|
||||
|
||||
# whole lot of whitespace changes
|
||||
0cecd677561d1992859f30dc1e233d8d5d83c9ad
|
3
.gitattributes
vendored
3
.gitattributes
vendored
|
@ -1,3 +0,0 @@
|
|||
loader/include/Geode/cocos/** linguist-vendored
|
||||
loader/include/Geode/external/** linguist-vendored
|
||||
loader/include/Geode/fmod/** linguist-vendored
|
85
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
85
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
|
@ -1,85 +0,0 @@
|
|||
name: Bug Report
|
||||
description: Report a Geode bug (not mods themselves) where something is not working as expected in Geode Loader (not mods created by others), which does not crash the game.
|
||||
labels: [ "unverified", "bug" ]
|
||||
body:
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Geode Issue
|
||||
description: |
|
||||
The Geode repository is for issues of *Geode Loader*, not individual mods created by other developers.
|
||||
When submitting a bug report, please make sure that the bug is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination.
|
||||
Failing to do this will get your issue *closed without explanation*.
|
||||
options:
|
||||
- label: I confirm that this bug is NOT related to a mod but directly to Geode Loader itself.
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: platform
|
||||
attributes:
|
||||
label: Platform
|
||||
description: The platform you were using when this bug was encountered.
|
||||
options:
|
||||
- "MacOS"
|
||||
- "Windows"
|
||||
- "Android64"
|
||||
- "Android32"
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: commit
|
||||
attributes:
|
||||
label: SDK commit
|
||||
description: The commit you used to compile your code with. If the bug is not related with your mod, you can leave this field empty.
|
||||
placeholder: "Example: a674b97"
|
||||
validations:
|
||||
required: false
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: Geode Version
|
||||
description: The version of Geode you were using when this bug was encountered. If you do not know where to find this, look for the mods listing.
|
||||
placeholder: "Example: v0.5.4"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: mods
|
||||
attributes:
|
||||
label: Mods Installed
|
||||
description: The mods and their respective versions used when this bug was encountered. If you were not using mods, please leave this field blank.
|
||||
placeholder: "Example: geode.test v1.0.0, geode.testdep v0.1.0"
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: Expected Behavior
|
||||
description: What you expected to happen. Attach screenshots here as necessary.
|
||||
placeholder: "Example: Expected to produce X by consuming Y."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: result
|
||||
attributes:
|
||||
label: Actual Behavior
|
||||
description: What happened despite your expectations. Attach screenshots here as necessary.
|
||||
placeholder: "Example: Produced one X but Y was not consumed."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduction
|
||||
attributes:
|
||||
label: Steps to Reproduce
|
||||
description: How to reproduce the bug.
|
||||
placeholder: "Example: 1) I did X..."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: additional-info
|
||||
attributes:
|
||||
label: Additional Information
|
||||
description: Any additional information you wish to provide. Please add anything which did not fit into the other sections here.
|
||||
placeholder: "Example: This is likely caused by X because..."
|
||||
validations:
|
||||
required: false
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: Thank you for taking the time to fill out this bug report.
|
4
.github/ISSUE_TEMPLATE/config.yml
vendored
4
.github/ISSUE_TEMPLATE/config.yml
vendored
|
@ -1,4 +0,0 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Discord link
|
||||
about: Find us at https://discord.gg/9e43WMKzhp
|
69
.github/ISSUE_TEMPLATE/crash-report.yml
vendored
69
.github/ISSUE_TEMPLATE/crash-report.yml
vendored
|
@ -1,69 +0,0 @@
|
|||
name: Crash Report
|
||||
description: Report a Geode bug (not mods themselves) that crashes the game or prevents startup caused by Geode Loader (not mods created by others).
|
||||
labels: [ "unverified", "crash" ]
|
||||
body:
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Geode Issue
|
||||
description: |
|
||||
The Geode repository is for issues of *Geode Loader*, not individual mods created by other developers.
|
||||
When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination.
|
||||
Failing to do this will get your issue *closed without explanation*.
|
||||
options:
|
||||
- label: I confirm that this crash is NOT related to a mod but directly to Geode Loader itself.
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: platform
|
||||
attributes:
|
||||
label: Platform
|
||||
description: The platform you were using when this bug was encountered.
|
||||
options:
|
||||
- "MacOS"
|
||||
- "Windows"
|
||||
- "Android64"
|
||||
- "Android32"
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: Geode Version
|
||||
description: The version of Geode you were using when this bug was encountered. If you do not know where to find this, look for the mods listing.
|
||||
placeholder: "Example: v0.5.4"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: mods
|
||||
attributes:
|
||||
label: Mods Installed
|
||||
description: The mods and their respective versions used when this bug was encountered. If you were not using mods, please leave this field blank.
|
||||
placeholder: "Example: geode.test v1.0.0, geode.testdep v0.1.0"
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: reproduction
|
||||
attributes:
|
||||
label: Steps to Reproduce
|
||||
description: How to reproduce the crash.
|
||||
placeholder: "Example: 1) I did X..."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: crash-report
|
||||
attributes:
|
||||
label: Crash Report
|
||||
description: "You can find the crash report in `geode/crashlogs/`, if one was created. Additionally, please attach latest log in `geode/log/`. If either or both files do not exist, state such. Please link to a paste site with their content, such as GitHub Gists or Pastebin. **Do not paste the contents of either these files directly into the text box.**"
|
||||
placeholder: "Example: a link to a paste site with the crash report and latest.log."
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: additional-info
|
||||
attributes:
|
||||
label: Additional Information
|
||||
description: Any additional information you wish to provide. Please add anything which did not fit into the other sections here.
|
||||
placeholder: "Example: This is likely caused by X because..."
|
||||
validations:
|
||||
required: false
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: Thank you for taking the time to fill out this crash report.
|
39
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
39
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
|
@ -1,39 +0,0 @@
|
|||
name: Request a Feature
|
||||
description: Request a new feature or a change to an existing one.
|
||||
labels: [ "feature" ]
|
||||
body:
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: Geode Version
|
||||
description: The version of Geode you are using for suggesting a feature on. If you do not know where to find this, look for the mods listing.
|
||||
placeholder: "Example: v0.5.4"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Related Problem
|
||||
description: If the feature you wish to change is related to a problem, please describe it. Leave this field blank if it is not related to a problem.
|
||||
placeholder: "Example: I'm always frustrated when..."
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: solution
|
||||
attributes:
|
||||
label: Your Solution
|
||||
description: Describe the solution you would like to have happen.
|
||||
placeholder: "Example: If I could..."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: additional-info
|
||||
attributes:
|
||||
label: Additional Information
|
||||
description: Any additional information you wish to provide. Please add anything which did not fit into the other sections here.
|
||||
placeholder: "Example: This is likely achievable by doing X because..."
|
||||
validations:
|
||||
required: false
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: Thank you for taking the time to fill out this feature request.
|
19
.github/ISSUE_TEMPLATE/question.yml
vendored
19
.github/ISSUE_TEMPLATE/question.yml
vendored
|
@ -1,19 +0,0 @@
|
|||
name: Ask a Question
|
||||
description: Ask a question regarding this project.
|
||||
labels: [ "question" ]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
If you are in need of quick response, Discord may be a better place. We are quite active on Discord, so you may get responses quicker.
|
||||
- type: textarea
|
||||
id: question
|
||||
attributes:
|
||||
label: Your Question
|
||||
description: Feel free to ask any question regarding this project here.
|
||||
placeholder: "Example: How can I...?"
|
||||
validations:
|
||||
required: true
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: Thank you for taking the time to ask me a question.
|
33
.github/actions/build-debug-info-post/action.yml
vendored
33
.github/actions/build-debug-info-post/action.yml
vendored
|
@ -1,33 +0,0 @@
|
|||
name: Prepare for Build Debug Info
|
||||
description: Provides debug info for the build process
|
||||
|
||||
inputs:
|
||||
target:
|
||||
description: 'Target platform: win, mac, android32 or android64'
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Preprocess
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir build-debug-info-preprocessed
|
||||
cd build
|
||||
sed 's/\\\\/\//g' compile_commands.json | sed 's/D:\//\/d\//' > uni_compile_commands.json
|
||||
pip install compile-commands --break-system-packages
|
||||
compile-commands --file=uni_compile_commands.json --filter_files='.*info\.rc.*' --filter='(.*) -o (.*)((?:/|\\).*)\.(?:obj|o) -c (.*)' --replacement="$BASH"' --noprofile --norc -c "mkdir -p ../build-debug-info-preprocessed/\g<2> && \g<1> -o ../build-debug-info-preprocessed/\g<2>\g<3>.i -E \g<4>"' -o ../build-debug-info/preprocess_commands.json --run --verbose
|
||||
|
||||
- name: Upload Build Debug Info
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: geode-build-debug-info-${{ inputs.target }}
|
||||
path: ./build-debug-info/*
|
||||
if: success() || failure()
|
||||
|
||||
- name: Upload Preprocessed Files
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: geode-build-debug-info-preprocessed-${{ inputs.target }}
|
||||
path: ./build-debug-info-preprocessed/*
|
||||
if: success() || failure()
|
36
.github/actions/build-debug-info/action.yml
vendored
36
.github/actions/build-debug-info/action.yml
vendored
|
@ -1,36 +0,0 @@
|
|||
name: Prepare for Build Debug Info
|
||||
description: Provides debug info for the build process
|
||||
|
||||
inputs:
|
||||
has-sccache:
|
||||
description: 'Whether the build action has sccache'
|
||||
required: true
|
||||
outputs:
|
||||
extra-configure:
|
||||
description: 'Extra stuff for CMake configure step'
|
||||
value: |
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||
cp ./build/compile_commands.json ./build-debug-info/
|
||||
extra-build:
|
||||
description: 'Extra stuff for CMake build step'
|
||||
value: |
|
||||
python3 ./ninjatracing/ninjatracing ./build/.ninja_log > ./build-debug-info/ninja-trace.json
|
||||
${{ inputs.has-sccache && 'sccache --show-adv-stats' || '' }}
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Prepare
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir ./build-debug-info
|
||||
echo "SCCACHE_ERROR_LOG=$GITHUB_WORKSPACE/build-debug-info/sccache-log.txt" >> $GITHUB_ENV
|
||||
echo "SCCACHE_LOG=debug" >> $GITHUB_ENV
|
||||
echo "RUST_BACKTRACE=1" >> $GITHUB_ENV
|
||||
|
||||
- name: Checkout ninjatracing
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: 'nico/ninjatracing'
|
||||
path: ninjatracing
|
||||
submodules: recursive
|
58
.github/actions/setup-cache/action.yml
vendored
58
.github/actions/setup-cache/action.yml
vendored
|
@ -1,58 +0,0 @@
|
|||
name: Setup cache
|
||||
description: Sets up sccache, CPM cache, etc.
|
||||
|
||||
inputs:
|
||||
host:
|
||||
description: 'Host platform: win, mac or linux'
|
||||
required: true
|
||||
target:
|
||||
description: 'Target platform: win, mac, android32 or android64'
|
||||
required: true
|
||||
use-ccache:
|
||||
description: 'Whether to use ccache/sccache'
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
# https://github.com/mozilla/sccache/issues/2090
|
||||
- name: Download custom sccache
|
||||
uses: robinraju/release-downloader@v1.10
|
||||
with:
|
||||
repository: cgytrus/sccache
|
||||
latest: true
|
||||
fileName: 'sccache-*-x86_64-apple-darwin.zip'
|
||||
tarBall: false
|
||||
zipBall: false
|
||||
out-file-path: "epic-sccache"
|
||||
if: inputs.host == 'mac' && inputs.use-ccache
|
||||
|
||||
- name: Setup custom sccache
|
||||
shell: bash
|
||||
run: |
|
||||
7z x "epic-sccache/sccache-*-x86_64-apple-darwin.zip" -o"epic-sccache"
|
||||
echo "$GITHUB_WORKSPACE/epic-sccache" >> $GITHUB_PATH
|
||||
chmod +x "epic-sccache/sccache"
|
||||
if: inputs.host == 'mac' && inputs.use-ccache
|
||||
|
||||
- name: Setup sccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2.13
|
||||
with:
|
||||
variant: sccache
|
||||
key: ${{ inputs.target }}-v1
|
||||
if: inputs.use-ccache
|
||||
|
||||
- name: Setup CPM Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: cpm-cache
|
||||
key: cpm-${{ inputs.target }}-v1-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
|
||||
restore-keys: |
|
||||
cpm-${{ inputs.target }}-v1-
|
||||
|
||||
- name: Setup info.rc Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: build/**/info.rc*
|
||||
key: rc-${{ inputs.target }}-v1-${{ hashFiles('VERSION', 'loader/CMakeLists.txt', 'loader/src/platform/windows/info.rc.in') }}
|
||||
if: inputs.target == 'win'
|
41
.github/actions/setup-dump-sym/action.yml
vendored
41
.github/actions/setup-dump-sym/action.yml
vendored
|
@ -1,41 +0,0 @@
|
|||
name: Setup Breakpad Dump Symbols
|
||||
description: Sets up + builds the dump_syms utility from Breakpad
|
||||
|
||||
inputs:
|
||||
dump_syms_version:
|
||||
description: "Revision of mozilla/dump_syms repository to fetch"
|
||||
required: true
|
||||
default: "v2.3.3"
|
||||
outputs:
|
||||
binary-path:
|
||||
description: "Path of the dump_syms utility, including the executable."
|
||||
value: ${{ steps.get-path.outputs.binary-path }}
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
id: toolchain
|
||||
|
||||
- uses: actions/cache@v4
|
||||
id: binary-cache
|
||||
with:
|
||||
path: "./dump_syms/target/release/dump_syms"
|
||||
key: dump_syms-${{ inputs.dump_syms_version }}-${{steps.toolchain.outputs.cachekey}}
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
if: steps.binary-cache.outputs.cache-hit != 'true'
|
||||
with:
|
||||
repository: "mozilla/dump_syms"
|
||||
ref: ${{ inputs.dump_syms_version }}
|
||||
path: "./dump_syms"
|
||||
|
||||
- run: cargo build --release
|
||||
shell: bash
|
||||
if: steps.binary-cache.outputs.cache-hit != 'true'
|
||||
working-directory: "./dump_syms"
|
||||
|
||||
- run: echo "binary-path=$(realpath target/release/dump_syms)" >> "$GITHUB_OUTPUT"
|
||||
shell: bash
|
||||
id: get-path
|
||||
working-directory: "./dump_syms"
|
17
.github/actions/setup-ninja/action.yml
vendored
17
.github/actions/setup-ninja/action.yml
vendored
|
@ -1,17 +0,0 @@
|
|||
name: Setup Ninja
|
||||
description: Sets up Ninja
|
||||
|
||||
inputs:
|
||||
host:
|
||||
description: 'Host platform: win, mac or linux'
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Setup
|
||||
shell: bash
|
||||
run: |
|
||||
curl -L https://github.com/ninja-build/ninja/releases/latest/download/ninja-${{ inputs.host }}.zip -o ninja.zip
|
||||
7z x ninja.zip -o"$GITHUB_WORKSPACE/ninja"
|
||||
echo "$GITHUB_WORKSPACE/ninja" >> $GITHUB_PATH
|
438
.github/workflows/build.yml
vendored
438
.github/workflows/build.yml
vendored
|
@ -1,438 +0,0 @@
|
|||
name: Build Binaries
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
build-debug-info:
|
||||
description: 'Profile and debug the build process'
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
use-ccache:
|
||||
description: 'Enable ccache/sccache'
|
||||
required: false
|
||||
default: true
|
||||
type: boolean
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- '**' # every branch
|
||||
- '!no-build-**' # unless marked as no-build
|
||||
|
||||
env:
|
||||
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm-cache
|
||||
base-configure-command: >-
|
||||
cmake -B build
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
-DGEODE_CODEGEN_CMAKE_ARGS="-DCMAKE_C_COMPILER=clang;-DCMAKE_CXX_COMPILER=clang++;-G Ninja"
|
||||
-G Ninja
|
||||
base-build-command: |
|
||||
cmake --build build --config RelWithDebInfo --parallel
|
||||
rm bin/nightly/resources/.geode_cache
|
||||
|
||||
jobs:
|
||||
build-windows:
|
||||
name: Build Windows
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Prepare for Build Debug Info
|
||||
id: build-debug-info
|
||||
uses: ./.github/actions/build-debug-info
|
||||
with:
|
||||
has-sccache: ${{ inputs.use-ccache }}
|
||||
if: inputs.build-debug-info
|
||||
|
||||
- name: Setup caches
|
||||
uses: ./.github/actions/setup-cache
|
||||
with:
|
||||
host: linux
|
||||
target: win
|
||||
use-ccache: ${{ github.event_name != 'workflow_dispatch' || inputs.use-ccache }}
|
||||
|
||||
- name: Setup Ninja
|
||||
uses: ./.github/actions/setup-ninja
|
||||
with:
|
||||
host: linux
|
||||
|
||||
- name: Setup CLI
|
||||
uses: geode-sdk/cli/.github/actions/setup@main
|
||||
|
||||
- name: Download xwin
|
||||
uses: robinraju/release-downloader@v1.10
|
||||
with:
|
||||
repository: Jake-Shadle/xwin
|
||||
latest: true
|
||||
fileName: 'xwin-*-x86_64-unknown-linux-musl.tar.gz'
|
||||
tarBall: false
|
||||
zipBall: false
|
||||
out-file-path: "epic-xwin"
|
||||
|
||||
- name: Prepare xwin
|
||||
run: |
|
||||
tar -xzf epic-xwin/xwin-*-x86_64-unknown-linux-musl.tar.gz -C epic-xwin
|
||||
mv epic-xwin/xwin-*-x86_64-unknown-linux-musl/xwin ./xwin
|
||||
./xwin --arch x86_64 --sdk-version 10.0.22621 --accept-license list
|
||||
|
||||
# this caches '.xwin-cache/**/*' but that's actually only gonna
|
||||
# contain the manifest cuz we only ran `xwin list` so far
|
||||
- name: Setup xwin Cache
|
||||
id: xwin-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .xwin-cache
|
||||
key: xwin-win-v1-${{ hashFiles('.xwin-cache/**/*') }}
|
||||
|
||||
- name: Download Windows headers
|
||||
run: ./xwin --arch x86_64 --sdk-version 10.0.22621 --accept-license splat --include-debug-libs
|
||||
if: steps.xwin-cache.outputs.cache-hit != 'true'
|
||||
|
||||
- name: Download clang-msvc-sdk toolchain
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: 'geode-sdk/clang-msvc-sdk'
|
||||
path: toolchain
|
||||
submodules: recursive
|
||||
|
||||
- name: Configure
|
||||
run: ${{ env.base-configure-command }} -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN ${{ steps.build-debug-info.outputs.extra-configure }}
|
||||
env:
|
||||
SPLAT_DIR: ${{ github.workspace }}/.xwin-cache/splat
|
||||
TOOLCHAIN: ${{ github.workspace }}/toolchain/clang-msvc.cmake
|
||||
HOST_ARCH: x86_64
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
${{ env.base-build-command }}
|
||||
${{ steps.build-debug-info.outputs.extra-build }}
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: geode-win
|
||||
path: ./bin/nightly
|
||||
|
||||
- name: Package Installer
|
||||
run: |
|
||||
sudo apt install nsis
|
||||
makensis -WX -V3 ./installer/windows/installer.nsi
|
||||
|
||||
- name: Upload Installer
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: geode-installer-win
|
||||
path: './installer/windows/geode-installer-win.exe'
|
||||
|
||||
- name: Complete Build Debug Info
|
||||
uses: ./.github/actions/build-debug-info-post
|
||||
with:
|
||||
target: win
|
||||
if: inputs.build-debug-info && (success() || failure())
|
||||
|
||||
build-mac:
|
||||
name: Build macOS
|
||||
runs-on: macos-latest
|
||||
|
||||
env:
|
||||
SCCACHE_CACHE_MULTIARCH: 1
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Prepare for Build Debug Info
|
||||
id: build-debug-info
|
||||
uses: ./.github/actions/build-debug-info
|
||||
with:
|
||||
has-sccache: ${{ inputs.use-ccache }}
|
||||
if: inputs.build-debug-info
|
||||
|
||||
# due to very strange performance issues, sccache is currently disabled for macos. sorry
|
||||
|
||||
# - name: Setup caches
|
||||
# uses: ./.github/actions/setup-cache
|
||||
# with:
|
||||
# host: mac
|
||||
# target: mac
|
||||
# use-ccache: ${{ github.event_name != 'workflow_dispatch' || inputs.use-ccache }}
|
||||
|
||||
- name: Setup Ninja
|
||||
uses: ./.github/actions/setup-ninja
|
||||
with:
|
||||
host: mac
|
||||
|
||||
- name: Setup CLI
|
||||
uses: geode-sdk/cli/.github/actions/setup@main
|
||||
|
||||
- name: Configure
|
||||
run: >
|
||||
${{ env.base-configure-command }}
|
||||
-DCMAKE_C_COMPILER=clang
|
||||
-DCMAKE_CXX_COMPILER=clang++
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
|
||||
-DGEODE_DISABLE_PRECOMPILED_HEADERS=OFF
|
||||
${{ steps.build-debug-info.outputs.extra-configure }}
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
${{ env.base-build-command }}
|
||||
${{ steps.build-debug-info.outputs.extra-build }}
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: geode-mac
|
||||
path: ./bin/nightly
|
||||
|
||||
- name: Package Installer
|
||||
run: ./installer/mac/package.sh ./bin/nightly ./installer/mac/geode-installer-mac.pkg
|
||||
|
||||
- name: Upload Installer
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: geode-installer-mac
|
||||
path: './installer/mac/geode-installer-mac.pkg'
|
||||
|
||||
- name: Complete Build Debug Info
|
||||
uses: ./.github/actions/build-debug-info-post
|
||||
with:
|
||||
target: mac
|
||||
if: inputs.build-debug-info && (success() || failure())
|
||||
|
||||
build-android:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- name: Android (32-bit)
|
||||
id: android32
|
||||
extra-configure: -DANDROID_ABI=armeabi-v7a
|
||||
|
||||
- name: Android (64-bit)
|
||||
id: android64
|
||||
extra-configure: -DANDROID_ABI=arm64-v8a
|
||||
|
||||
name: Build ${{ matrix.config.name }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Prepare for Build Debug Info
|
||||
id: build-debug-info
|
||||
uses: ./.github/actions/build-debug-info
|
||||
with:
|
||||
has-sccache: ${{ inputs.use-ccache }}
|
||||
if: inputs.build-debug-info
|
||||
|
||||
- name: Setup caches
|
||||
uses: ./.github/actions/setup-cache
|
||||
with:
|
||||
host: linux
|
||||
target: ${{ matrix.config.id }}
|
||||
use-ccache: ${{ github.event_name != 'workflow_dispatch' || inputs.use-ccache }}
|
||||
|
||||
- name: Setup Ninja
|
||||
uses: ./.github/actions/setup-ninja
|
||||
with:
|
||||
host: linux
|
||||
|
||||
- name: Setup CLI
|
||||
uses: geode-sdk/cli/.github/actions/setup@main
|
||||
|
||||
- name: Setup Breakpad Tools
|
||||
uses: ./.github/actions/setup-dump-sym
|
||||
id: breakpad-tools
|
||||
|
||||
- name: Fix Ubuntu libcstd++
|
||||
run: |
|
||||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
|
||||
sudo apt-get update
|
||||
sudo apt-get install --only-upgrade libstdc++6
|
||||
|
||||
- name: Configure
|
||||
run: >
|
||||
${{ env.base-configure-command }}
|
||||
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake
|
||||
-DCMAKE_C_COMPILER=clang
|
||||
-DCMAKE_CXX_COMPILER=clang++
|
||||
-DANDROID_PLATFORM=android-23
|
||||
-DANDROID_STL=c++_shared
|
||||
${{ matrix.config.extra-configure }}
|
||||
${{ steps.build-debug-info.outputs.extra-configure }}
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
${{ env.base-build-command }}
|
||||
${{ steps.build-debug-info.outputs.extra-build }}
|
||||
|
||||
# hardcoding toolchain path :(
|
||||
- name: Dump Symbols
|
||||
run: |
|
||||
${{ steps.breakpad-tools.outputs.binary-path }} ./bin/nightly/Geode.${{ matrix.config.id }}.so -o ./bin/nightly/Geode.${{ matrix.config.id }}.so.sym
|
||||
$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip ./bin/nightly/Geode.${{ matrix.config.id }}.so
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: geode-${{ matrix.config.id }}
|
||||
path: ./bin/nightly
|
||||
|
||||
- name: Complete Build Debug Info
|
||||
uses: ./.github/actions/build-debug-info-post
|
||||
with:
|
||||
target: ${{ matrix.config.id }}
|
||||
if: inputs.build-debug-info && (success() || failure())
|
||||
|
||||
build-ios:
|
||||
name: Build iOS
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Prepare for Build Debug Info
|
||||
id: build-debug-info
|
||||
uses: ./.github/actions/build-debug-info
|
||||
with:
|
||||
has-sccache: ${{ inputs.use-ccache }}
|
||||
if: inputs.build-debug-info
|
||||
|
||||
- name: Setup caches
|
||||
uses: ./.github/actions/setup-cache
|
||||
with:
|
||||
host: mac
|
||||
target: ios
|
||||
use-ccache: ${{ github.event_name != 'workflow_dispatch' || inputs.use-ccache }}
|
||||
|
||||
- name: Setup Ninja
|
||||
uses: ./.github/actions/setup-ninja
|
||||
with:
|
||||
host: mac
|
||||
|
||||
- name: Install LLVM
|
||||
run: |
|
||||
brew install llvm
|
||||
echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Setup CLI
|
||||
uses: geode-sdk/cli/.github/actions/setup@main
|
||||
|
||||
- name: Configure
|
||||
run: >
|
||||
${{ env.base-configure-command }}
|
||||
-DGEODE_TARGET_PLATFORM=iOS
|
||||
-DCMAKE_SYSTEM_NAME=iOS
|
||||
-DGEODE_DONT_BUILD_TEST_MODS=ON
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
${{ steps.build-debug-info.outputs.extra-configure }}
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
${{ env.base-build-command }}
|
||||
${{ steps.build-debug-info.outputs.extra-build }}
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: geode-ios
|
||||
path: ./bin/nightly
|
||||
|
||||
- name: Complete Build Debug Info
|
||||
uses: ./.github/actions/build-debug-info-post
|
||||
with:
|
||||
target: mac
|
||||
if: inputs.build-debug-info && (success() || failure())
|
||||
|
||||
|
||||
publish:
|
||||
name: Publish
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ build-windows, build-mac, build-android, build-ios ]
|
||||
if: github.ref == 'refs/heads/main'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Declare Version Variables
|
||||
id: ref
|
||||
run: |
|
||||
echo "version=$(cat VERSION | xargs)" >> $GITHUB_OUTPUT
|
||||
echo "hash=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
|
||||
- name: Move Installers
|
||||
run: |
|
||||
mv geode-installer-mac/geode-installer-mac.pkg geode-installer-${{ steps.ref.outputs.hash }}-mac.pkg
|
||||
mv geode-installer-win/geode-installer-win.exe geode-installer-${{ steps.ref.outputs.hash }}-win.exe
|
||||
|
||||
- name: Zip MacOS Artifacts
|
||||
uses: vimtor/action-zip@v1.2
|
||||
with:
|
||||
files: geode-mac/Geode.dylib geode-mac/GeodeBootstrapper.dylib
|
||||
dest: geode-${{ steps.ref.outputs.hash }}-mac.zip
|
||||
|
||||
- name: Zip Windows Artifacts
|
||||
uses: vimtor/action-zip@v1.2
|
||||
with:
|
||||
files: geode-win/XInput1_4.dll geode-win/Geode.dll geode-win/GeodeUpdater.exe geode-win/Geode.lib geode-win/Geode.pdb
|
||||
dest: geode-${{ steps.ref.outputs.hash }}-win.zip
|
||||
|
||||
- name: Zip Android32 Artifacts
|
||||
uses: vimtor/action-zip@v1.2
|
||||
with:
|
||||
files: geode-android32/Geode.android32.so geode-android32/Geode.android32.so.sym
|
||||
dest: geode-${{ steps.ref.outputs.hash }}-android32.zip
|
||||
|
||||
- name: Zip Android64 Artifacts
|
||||
uses: vimtor/action-zip@v1.2
|
||||
with:
|
||||
files: geode-android64/Geode.android64.so geode-android64/Geode.android64.so.sym
|
||||
dest: geode-${{ steps.ref.outputs.hash }}-android64.zip
|
||||
|
||||
- name: Zip iOS Artifacts
|
||||
uses: vimtor/action-zip@v1.2
|
||||
with:
|
||||
files: geode-ios/Geode.ios.dylib
|
||||
dest: geode-${{ steps.ref.outputs.hash }}-ios.zip
|
||||
|
||||
- name: Zip Resources
|
||||
uses: vimtor/action-zip@v1.2
|
||||
with:
|
||||
files: geode-android64/resources
|
||||
dest: resources.zip
|
||||
|
||||
- name: Update Development Release
|
||||
uses: andelf/nightly-release@main
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: nightly
|
||||
name: 'Development Release'
|
||||
body: |
|
||||
Geode development release for commit ${{ github.sha }}. Since this is not a regular release, Geode will not install the resources automatically, so you should use the installer if you want them.
|
||||
files: |
|
||||
./geode-installer-${{ steps.ref.outputs.hash }}-win.exe
|
||||
./geode-installer-${{ steps.ref.outputs.hash }}-mac.pkg
|
||||
./geode-${{ steps.ref.outputs.hash }}-win.zip
|
||||
./geode-${{ steps.ref.outputs.hash }}-mac.zip
|
||||
./geode-${{ steps.ref.outputs.hash }}-android32.zip
|
||||
./geode-${{ steps.ref.outputs.hash }}-android64.zip
|
||||
./geode-${{ steps.ref.outputs.hash }}-ios.zip
|
||||
./resources.zip
|
26
.github/workflows/check-changelog.yml
vendored
26
.github/workflows/check-changelog.yml
vendored
|
@ -1,26 +0,0 @@
|
|||
# check the changelog for non ascii characters
|
||||
name: Check CHANGELOG.md
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'CHANGELOG.md'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'CHANGELOG.md'
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Check CHANGELOG.md
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- run: |
|
||||
if grep -q -P -n "[\x80-\xFF]" CHANGELOG.md
|
||||
then
|
||||
exit 1;
|
||||
fi
|
68
.github/workflows/draft.yml
vendored
68
.github/workflows/draft.yml
vendored
|
@ -1,68 +0,0 @@
|
|||
name: Draft Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
draft:
|
||||
name: Draft Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download Development Release
|
||||
uses: robinraju/release-downloader@v1.9
|
||||
with:
|
||||
tag: nightly
|
||||
fileName: '*'
|
||||
tarBall: false
|
||||
zipBall: true
|
||||
out-file-path: 'dev'
|
||||
|
||||
- name: Declare Version Variable
|
||||
id: ref
|
||||
shell: bash
|
||||
run: |
|
||||
VERSION=$(unzip -p ${{ github.workspace }}/dev/geode-nightly.zip geode-sdk-geode-*/VERSION | xargs)
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
# test if release already exists
|
||||
set +e
|
||||
curl --fail "https://api.github.com/repos/geode-sdk/geode/releases/tags/v$VERSION" --silent --output /dev/null
|
||||
RESULT=$?
|
||||
set -e
|
||||
|
||||
if [ $RESULT -eq 0 ]; then
|
||||
echo "Release $VERSION already exists! Not replacing it.."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Move Files
|
||||
run: |
|
||||
mv dev/geode-installer-*-win.exe geode-installer-v${{ steps.ref.outputs.version }}-win.exe
|
||||
mv dev/geode-installer-*-mac.pkg geode-installer-v${{ steps.ref.outputs.version }}-mac.pkg
|
||||
mv dev/geode-*-win.zip geode-v${{ steps.ref.outputs.version }}-win.zip
|
||||
mv dev/geode-*-mac.zip geode-v${{ steps.ref.outputs.version }}-mac.zip
|
||||
mv dev/geode-*-android32.zip geode-v${{ steps.ref.outputs.version }}-android32.zip
|
||||
mv dev/geode-*-android64.zip geode-v${{ steps.ref.outputs.version }}-android64.zip
|
||||
mv dev/resources.zip resources.zip
|
||||
|
||||
- name: Create Draft Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: v${{ steps.ref.outputs.version }}
|
||||
name: Geode v${{ steps.ref.outputs.version }}
|
||||
body: |
|
||||
TODO before publishing:
|
||||
- mark if pre-release
|
||||
- add changelog
|
||||
- remove this
|
||||
draft: true
|
||||
files: |
|
||||
./geode-installer-v${{ steps.ref.outputs.version }}-win.exe
|
||||
./geode-installer-v${{ steps.ref.outputs.version }}-mac.pkg
|
||||
./geode-v${{ steps.ref.outputs.version }}-win.zip
|
||||
./geode-v${{ steps.ref.outputs.version }}-mac.zip
|
||||
./geode-v${{ steps.ref.outputs.version }}-android32.zip
|
||||
./geode-v${{ steps.ref.outputs.version }}-android64.zip
|
||||
./resources.zip
|
26
.github/workflows/update-site.yml
vendored
26
.github/workflows/update-site.yml
vendored
|
@ -1,26 +0,0 @@
|
|||
# Update the install page on the geode-sdk/website repository
|
||||
name: Update Website
|
||||
|
||||
on:
|
||||
# # trigger when a new release is released
|
||||
# release:
|
||||
# types:
|
||||
# - released
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
trigger:
|
||||
name: Trigger site build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ secrets.GEODE_BOT_PUSH_BIN_TOKEN }}
|
||||
script: |
|
||||
await github.rest.actions.createWorkflowDispatch({
|
||||
owner: 'geode-sdk',
|
||||
repo: 'website',
|
||||
workflow_id: 'build.yml',
|
||||
ref: 'main'
|
||||
})
|
86
.gitignore
vendored
86
.gitignore
vendored
|
@ -1,86 +0,0 @@
|
|||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
# Macos be like
|
||||
**/.DS_Store
|
||||
|
||||
# Cache files for Sublime Text
|
||||
**/*.tmlanguage.cache
|
||||
**/*.tmPreferences.cache
|
||||
**/*.stTheme.cache
|
||||
.cache
|
||||
|
||||
# Workspace files are user-specific
|
||||
**/*.sublime-workspace
|
||||
**/*.sublime-project
|
||||
.vscode
|
||||
.vs
|
||||
.idea
|
||||
|
||||
# Ignore build folders
|
||||
**/build
|
||||
build
|
||||
build2
|
||||
build-docs/
|
||||
bin
|
||||
/build-*
|
||||
|
||||
# Ignore docs folders
|
||||
docs/**
|
||||
docs
|
||||
docs-dist/
|
||||
|
||||
# Ignore codegenned files
|
||||
loader/src/internal/about.cpp
|
||||
loader/src/internal/resources.hpp
|
||||
loader/resources/mod.json
|
||||
loader/test/dependency/mod.json
|
||||
loader/test/main/mod.json
|
||||
loader/resources/version
|
||||
loader/resources/blanks/rename.js
|
||||
loader/resources/about.md
|
||||
loader/resources/changelog.md
|
||||
loader/resources/support.md
|
||||
|
||||
# Ignore generated files
|
||||
installer/mac/*.pkg
|
||||
installer/windows/*.exe
|
||||
|
||||
# Ignore fod's include directories which are stored in this funny file
|
||||
fods-catgirl-hideout.txt
|
||||
|
||||
# Ignore I don't even know what that is probably fod's flash testing script
|
||||
test-docs.bat
|
||||
|
||||
# Ignore krita files too because we don't want our project files shaking my head
|
||||
**/*.kra
|
||||
|
||||
# Ignore clangd cache
|
||||
.cache
|
||||
|
||||
# Add bindings folder to ignore list, so people can clone a local copy of them there
|
||||
bindings
|
||||
bindings/**
|
1239
CHANGELOG.md
1239
CHANGELOG.md
File diff suppressed because it is too large
Load diff
343
CMakeLists.txt
343
CMakeLists.txt
|
@ -1,343 +0,0 @@
|
|||
cmake_minimum_required(VERSION 3.25 FATAL_ERROR)
|
||||
|
||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT Embedded)
|
||||
cmake_policy(SET CMP0141 NEW)
|
||||
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build libraries static" FORCE)
|
||||
|
||||
# Docs flags
|
||||
if (GEODE_BUILDING_DOCS)
|
||||
set(GEODE_DISABLE_CLI_CALLS ON)
|
||||
set(GEODE_DISABLE_PRECOMPILED_HEADERS ON)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
set(GEODE_DONT_BUILD_TEST_MODS ON)
|
||||
endif()
|
||||
|
||||
option(GEODE_USE_BREAKPAD "Enables the use of the Breakpad library for crash dumps." ON)
|
||||
|
||||
# Check if git is installed, raise a fatal error if not
|
||||
find_program(GIT_EXECUTABLE git)
|
||||
if (NOT GIT_EXECUTABLE)
|
||||
message(FATAL_ERROR "Git not found! Please install Git and try again.\nhttps://git-scm.com/")
|
||||
endif()
|
||||
|
||||
# Read version
|
||||
file(READ VERSION GEODE_VERSION)
|
||||
string(STRIP "${GEODE_VERSION}" GEODE_VERSION)
|
||||
set(GEODE_VERSION "${GEODE_VERSION}" CACHE INTERNAL "Geode version")
|
||||
set(GEODE_VERSION_FULL "${GEODE_VERSION}" CACHE INTERNAL "Geode version full")
|
||||
|
||||
# Check if version has a tag like v1.0.0-alpha
|
||||
string(FIND ${GEODE_VERSION} "-" GEODE_VERSION_HAS_TAG)
|
||||
if (NOT ${GEODE_VERSION_HAS_TAG} EQUAL "-1")
|
||||
string(REGEX MATCH "[a-z]+(\.[0-9]+)?$" GEODE_VERSION_TAG ${GEODE_VERSION})
|
||||
string(SUBSTRING "${GEODE_VERSION}" 0 ${GEODE_VERSION_HAS_TAG} GEODE_VERSION)
|
||||
string(FIND ${GEODE_VERSION_TAG} "." GEODE_VERSION_TAG_HAS_NUMBER)
|
||||
|
||||
# Extract tag type and number from tag
|
||||
if (NOT ${GEODE_VERSION_TAG_HAS_NUMBER} EQUAL "-1")
|
||||
string(SUBSTRING "${GEODE_VERSION_TAG}" 0 ${GEODE_VERSION_TAG_HAS_NUMBER} GEODE_VERSION_TAG_TYPE)
|
||||
math(EXPR GEODE_VERSION_TAG_HAS_NUMBER "${GEODE_VERSION_TAG_HAS_NUMBER} + 1")
|
||||
string(SUBSTRING "${GEODE_VERSION_TAG}" ${GEODE_VERSION_TAG_HAS_NUMBER} -1 GEODE_VERSION_TAG_NUMBER)
|
||||
else()
|
||||
set(GEODE_VERSION_TAG_TYPE "${GEODE_VERSION_TAG}")
|
||||
set(GEODE_VERSION_TAG_NUMBER "")
|
||||
endif()
|
||||
|
||||
# Capitalize first letter of tag type
|
||||
string(SUBSTRING ${GEODE_VERSION_TAG_TYPE} 0 1 FIRST_LETTER)
|
||||
string(TOUPPER ${FIRST_LETTER} FIRST_LETTER)
|
||||
string(REGEX REPLACE "^.(.*)" "${FIRST_LETTER}\\1" GEODE_VERSION_TAG_TYPE "${GEODE_VERSION_TAG_TYPE}")
|
||||
|
||||
message(STATUS "Version: ${GEODE_VERSION}, tag: ${GEODE_VERSION_TAG} (type: ${GEODE_VERSION_TAG_TYPE}, number: ${GEODE_VERSION_TAG_NUMBER})")
|
||||
else()
|
||||
set(GEODE_VERSION_TAG "")
|
||||
set(GEODE_VERSION_TAG_TYPE "")
|
||||
set(GEODE_VERSION_TAG_NUMBER "")
|
||||
|
||||
message(STATUS "Version: ${GEODE_VERSION}")
|
||||
endif()
|
||||
|
||||
include(cmake/CPM.cmake)
|
||||
|
||||
if (NOT DEFINED CPM_SOURCE_CACHE)
|
||||
message(NOTICE "Not using CPM cache (CPM_SOURCE_CACHE). "
|
||||
"It is recommended to use it to improve configure times.")
|
||||
endif()
|
||||
|
||||
# Allow users to have their own copy of bindings that can be overwritten with a CMake option.
|
||||
# If the option is not provided, by default just clone bindings with CPM and use that
|
||||
if (DEFINED ENV{GEODE_BINDINGS_REPO_PATH})
|
||||
set(temp $ENV{GEODE_BINDINGS_REPO_PATH})
|
||||
# this is so stupid i hate windows paths
|
||||
string(REPLACE "\\" "/" GEODE_BINDINGS_REPO_PATH ${temp})
|
||||
endif()
|
||||
|
||||
if (NOT GEODE_BINDINGS_REPO_PATH)
|
||||
message(STATUS
|
||||
"No override path for bindings provided, using CPM to clone default. "
|
||||
"If you would like to use a separate clone of the bindings repo "
|
||||
"(for example in order to be able to efficiently change and "
|
||||
"contribute new bindings) then set GEODE_BINDINGS_REPO_PATH to where you have "
|
||||
"cloned the repository (system environment variables are supported)."
|
||||
)
|
||||
CPMAddPackage(NAME "bindings"
|
||||
GITHUB_REPOSITORY "geode-sdk/bindings"
|
||||
GIT_TAG "main"
|
||||
DOWNLOAD_ONLY YES
|
||||
NO_CACHE YES
|
||||
)
|
||||
set(GEODE_BINDINGS_REPO_PATH ${bindings_SOURCE_DIR})
|
||||
else()
|
||||
message(STATUS "Using ${GEODE_BINDINGS_REPO_PATH} for bindings repo")
|
||||
endif()
|
||||
|
||||
project(geode-sdk VERSION ${GEODE_VERSION} LANGUAGES CXX C)
|
||||
|
||||
if (NOT GEODE_DONT_USE_CCACHE)
|
||||
message(STATUS "Looking for ccache/sccache")
|
||||
if (DEFINED CMAKE_C_COMPILER_LAUNCHER OR DEFINED CMAKE_CXX_COMPILER_LAUNCHER)
|
||||
message(STATUS "Looking for ccache/sccache - detecting variant")
|
||||
if (DEFINED CMAKE_C_COMPILER_LAUNCHER AND DEFINED CMAKE_CXX_COMPILER_LAUNCHER AND
|
||||
CMAKE_C_COMPILER_LAUNCHER STREQUAL CMAKE_CXX_COMPILER_LAUNCHER)
|
||||
if (CMAKE_CXX_COMPILER_LAUNCHER MATCHES "sccache(|.exe)$")
|
||||
message(STATUS "Looking for ccache/sccache - detected sccache")
|
||||
set(GEODE_CCACHE_VARIANT "sccache")
|
||||
elseif(CMAKE_CXX_COMPILER_LAUNCHER MATCHES "ccache(|.exe)$")
|
||||
message(STATUS "Looking for ccache/sccache - detected ccache")
|
||||
set(GEODE_CCACHE_VARIANT "ccache")
|
||||
else()
|
||||
message(STATUS "Looking for ccache/sccache - none (custom compiler launcher: {CMAKE_C_COMPILER_LAUNCHER}, {CMAKE_CXX_COMPILER_LAUNCHER})")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Looking for ccache/sccache - skipped (custom compiler launcher: {CMAKE_C_COMPILER_LAUNCHER}, {CMAKE_CXX_COMPILER_LAUNCHER})")
|
||||
endif()
|
||||
elseif (CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
message(STATUS "Looking for ccache/sccache - skipped (Visual Studio generator)")
|
||||
else()
|
||||
find_program(GEODE_CCACHE NAMES sccache ccache)
|
||||
if (GEODE_CCACHE)
|
||||
if (${GEODE_CCACHE} MATCHES "sccache(|.exe)$")
|
||||
set(GEODE_CCACHE_VARIANT "sccache")
|
||||
else()
|
||||
set(GEODE_CCACHE_VARIANT "ccache")
|
||||
endif()
|
||||
message(STATUS "Looking for ccache/sccache - found ${GEODE_CCACHE_VARIANT}")
|
||||
message(NOTICE "Compiler launcher not set but ccache/sccache was found. "
|
||||
"Setting compiler launcher to that")
|
||||
set(CMAKE_C_COMPILER_LAUNCHER ${GEODE_CCACHE})
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER ${GEODE_CCACHE})
|
||||
else()
|
||||
message(STATUS "Looking for ccache/sccache - not found")
|
||||
endif()
|
||||
unset(GEODE_CCACHE)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Not looking for ccache because GEODE_DONT_USE_CCACHE was ON")
|
||||
endif()
|
||||
|
||||
if (DEFINED GEODE_CCACHE_VARIANT)
|
||||
if (NOT DEFINED GEODE_DISABLE_PRECOMPILED_HEADERS)
|
||||
if (${GEODE_CCACHE_VARIANT} STREQUAL "sccache" AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
if (APPLE AND DEFINED CMAKE_OSX_ARCHITECTURES AND (CMAKE_OSX_ARCHITECTURES STREQUAL "arm64;x86_64" OR CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64;arm64"))
|
||||
message(NOTICE "Using ${GEODE_CCACHE_VARIANT} with ${CMAKE_CXX_COMPILER_ID} while building multiple architectures, PCH will be disabled due to issues with sccache.")
|
||||
message("(You can override this by setting GEODE_DISABLE_PRECOMPILED_HEADERS to ON).")
|
||||
|
||||
set(GEODE_DISABLE_PRECOMPILED_HEADERS ON)
|
||||
else()
|
||||
message(NOTICE "Using ${GEODE_CCACHE_VARIANT} with ${CMAKE_CXX_COMPILER_ID}, PCH will be enabled.")
|
||||
set(GEODE_DISABLE_PRECOMPILED_HEADERS OFF)
|
||||
endif()
|
||||
else()
|
||||
message(NOTICE "Using ${GEODE_CCACHE_VARIANT} with ${CMAKE_CXX_COMPILER_ID}, PCH will be disabled.")
|
||||
set(GEODE_DISABLE_PRECOMPILED_HEADERS ON)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
if (APPLE)
|
||||
# when building for multiple architectures, a caching compiler is not recommended
|
||||
message(NOTICE "Not using a caching compiler (ccache/sccache).")
|
||||
else()
|
||||
message(NOTICE "Not using a caching compiler (ccache/sccache). "
|
||||
"It is recommended to install one to improve build times.")
|
||||
message(NOTICE "We recommend sccache, check its README for installation instructions, "
|
||||
"normally you can just use your usual package manager (e.g. 'scoop install sccache').")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED GEODE_DISABLE_PRECOMPILED_HEADERS)
|
||||
message(NOTICE "Because of this, PCH will be enabled.")
|
||||
set(GEODE_DISABLE_PRECOMPILED_HEADERS OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED GEODE_DISABLE_PRECOMPILED_HEADERS)
|
||||
set(GEODE_DISABLE_PRECOMPILED_HEADERS OFF)
|
||||
endif()
|
||||
|
||||
if (GEODE_DISABLE_PRECOMPILED_HEADERS)
|
||||
message(STATUS "Pre-compiled headers - OFF")
|
||||
else()
|
||||
message(STATUS "Pre-compiled headers - ON")
|
||||
endif()
|
||||
|
||||
add_library(${PROJECT_NAME} INTERFACE)
|
||||
|
||||
# Rerun CMake on VERSION file change
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES CMAKE_CONFIGURE_DEPENDS VERSION)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} INTERFACE -DPROJECT_NAME=${CMAKE_PROJECT_NAME})
|
||||
|
||||
set(GEODE_BIN_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin)
|
||||
set(GEODE_LOADER_PATH ${CMAKE_CURRENT_SOURCE_DIR}/loader)
|
||||
set(GEODE_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
include(cmake/Platform.cmake)
|
||||
include(cmake/GeodeFile.cmake)
|
||||
|
||||
if (NOT DEFINED GEODE_GD_VERSION)
|
||||
set(GEODE_GD_VERSION 2.2074)
|
||||
set(GEODE_COMP_GD_VERSION 22074)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(
|
||||
${PROJECT_NAME} INTERFACE
|
||||
GEODE_GD_VERSION=${GEODE_GD_VERSION}
|
||||
GEODE_COMP_GD_VERSION=${GEODE_COMP_GD_VERSION}
|
||||
GEODE_GD_VERSION_STRING="${GEODE_GD_VERSION}"
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
# This allows you to compile in debug mode
|
||||
# add_compile_definitions(_HAS_ITERATOR_DEBUGGING=0)
|
||||
add_definitions(-D_HAS_ITERATOR_DEBUGGING=0)
|
||||
target_compile_definitions(${PROJECT_NAME} INTERFACE _HAS_ITERATOR_DEBUGGING=0)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} INTERFACE delayimp ws2_32)
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
|
||||
CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
|
||||
# target x86 on windows with clang
|
||||
target_compile_options(${PROJECT_NAME} INTERFACE --target=x86_64-pc-windows-msvc)
|
||||
target_link_options(${PROJECT_NAME} INTERFACE --target=x86_64-pc-windows-msvc)
|
||||
add_compile_options(--target=x86_64-pc-windows-msvc)
|
||||
add_link_options(--target=x86_64-pc-windows-msvc)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
# force an error on a missing return type, as this is unfortunately a common mistake people make
|
||||
target_compile_options(${PROJECT_NAME} INTERFACE -Werror=return-type)
|
||||
endif()
|
||||
|
||||
# if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
# set_property(TARGET ${PROJECT_NAME} PROPERTY LINKER_TYPE LLD)
|
||||
# target_link_options(${PROJECT_NAME} INTERFACE -fuse-ld=lld)
|
||||
# endif ()
|
||||
|
||||
# We do not support anything below SDK 23
|
||||
if (ANDROID)
|
||||
string(REGEX MATCH "[0-9]+" ANDROID_PLATFORM_NUMBER "${ANDROID_PLATFORM}")
|
||||
if (ANDROID_PLATFORM_NUMBER LESS 23)
|
||||
message(FATAL_ERROR "Specified target Android SDK version is too low (${ANDROID_PLATFORM_NUMBER}), must be 23 or higher")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(MAT_JSON_AS_INTERFACE ON)
|
||||
CPMAddPackage("gh:geode-sdk/result@1.3.3")
|
||||
CPMAddPackage("gh:geode-sdk/json@3.2.1")
|
||||
CPMAddPackage("gh:fmtlib/fmt#11.1.4")
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} INTERFACE MAT_JSON_DYNAMIC=1)
|
||||
|
||||
# this is needed for cross compilation on linux,
|
||||
# since fmtlib will fail to compile otherwise
|
||||
if (GEODE_DISABLE_FMT_CONSTEVAL)
|
||||
message(VERBOSE "Disabling FMT_CONSTEVAL")
|
||||
target_compile_definitions(fmt PUBLIC -DFMT_CONSTEVAL=)
|
||||
endif()
|
||||
|
||||
# Tulip hook (hooking)
|
||||
if (PROJECT_IS_TOP_LEVEL AND NOT GEODE_BUILDING_DOCS)
|
||||
set(TULIP_LINK_SOURCE ON)
|
||||
endif()
|
||||
set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE)
|
||||
|
||||
# Allow users to have their own copy of TulipHook that can be overwritten with a CMake option.
|
||||
# If the option is not provided, by default just clone TulipHook with CPM and use that
|
||||
if (DEFINED ENV{GEODE_TULIPHOOK_REPO_PATH})
|
||||
set(temp $ENV{GEODE_TULIPHOOK_REPO_PATH})
|
||||
# this is so stupid i hate windows paths
|
||||
string(REPLACE "\\" "/" GEODE_TULIPHOOK_REPO_PATH ${temp})
|
||||
endif()
|
||||
|
||||
if (DEFINED GEODE_TULIPHOOK_REPO_PATH)
|
||||
message(STATUS "Using ${GEODE_TULIPHOOK_REPO_PATH} for TulipHook")
|
||||
add_subdirectory(${GEODE_TULIPHOOK_REPO_PATH} ${GEODE_TULIPHOOK_REPO_PATH}/build)
|
||||
else()
|
||||
CPMAddPackage("gh:geode-sdk/TulipHook@2.4.3")
|
||||
endif()
|
||||
set(CMAKE_WARN_DEPRECATED ON CACHE BOOL "" FORCE)
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
check_cxx_compiler_flag(-Wno-everything SUPPORTS_W_NO_EVERYTHING)
|
||||
if (SUPPORTS_W_NO_EVERYTHING)
|
||||
# Silence warnings from dependencies
|
||||
if (TARGET capstone)
|
||||
target_compile_options(capstone PRIVATE -Wno-everything)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_sources(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/entry.cpp)
|
||||
|
||||
add_subdirectory(${GEODE_BINDINGS_REPO_PATH} ${CMAKE_BINARY_DIR}/bindings)
|
||||
|
||||
if (NOT GEODE_DISABLE_PRECOMPILED_HEADERS)
|
||||
target_precompile_headers(GeodeBindings INTERFACE
|
||||
"$<$<COMPILE_LANGUAGE:CXX>:${GEODE_LOADER_PATH}/include/Geode/Bindings.hpp>"
|
||||
)
|
||||
endif()
|
||||
|
||||
target_include_directories(GeodeBindings PUBLIC
|
||||
${GEODE_LOADER_PATH}/include
|
||||
${GEODE_LOADER_PATH}/include/Geode/cocos/include
|
||||
${GEODE_LOADER_PATH}/include/Geode/cocos/extensions
|
||||
${GEODE_LOADER_PATH}/include/Geode/fmod
|
||||
)
|
||||
target_link_directories(GeodeBindings PUBLIC ${GEODE_LOADER_PATH}/include/link)
|
||||
target_link_libraries(GeodeBindings PUBLIC fmt TulipHookInclude mat-json GeodeResult)
|
||||
target_link_libraries(${PROJECT_NAME} INTERFACE GeodeBindings)
|
||||
|
||||
if (NOT EXISTS ${GEODE_BIN_PATH})
|
||||
file(MAKE_DIRECTORY ${GEODE_BIN_PATH})
|
||||
endif()
|
||||
|
||||
if (NOT EXISTS ${GEODE_BIN_PATH}/${PROJECT_VERSION} AND EXISTS ${GEODE_BIN_PATH}/nightly/)
|
||||
set(GEODE_LINK_NIGHTLY 1)
|
||||
endif()
|
||||
|
||||
if (${GEODE_LINK_NIGHTLY})
|
||||
set(GEODE_PLATFORM_BIN_PATH ${GEODE_BIN_PATH}/nightly/${GEODE_PLATFORM_BINARY})
|
||||
else()
|
||||
set(GEODE_PLATFORM_BIN_PATH ${GEODE_BIN_PATH}/${PROJECT_VERSION}/${GEODE_PLATFORM_BINARY})
|
||||
endif()
|
||||
|
||||
if (PROJECT_IS_TOP_LEVEL)
|
||||
add_subdirectory(loader)
|
||||
target_link_libraries(${PROJECT_NAME} INTERFACE geode-loader)
|
||||
if (SUPPORTS_W_NO_EVERYTHING)
|
||||
target_compile_options(geode-loader PRIVATE -Wno-inconsistent-missing-override)
|
||||
endif()
|
||||
elseif (EXISTS ${GEODE_PLATFORM_BIN_PATH})
|
||||
target_link_libraries(${PROJECT_NAME} INTERFACE "${GEODE_PLATFORM_BIN_PATH}")
|
||||
if (NOT GEODE_DISABLE_PRECOMPILED_HEADERS)
|
||||
target_precompile_headers(${PROJECT_NAME} INTERFACE
|
||||
"$<$<COMPILE_LANGUAGE:CXX>:${GEODE_LOADER_PATH}/include/Geode/DefaultInclude.hpp>"
|
||||
"$<$<COMPILE_LANGUAGE:CXX>:${GEODE_LOADER_PATH}/include/Geode/Geode.hpp>"
|
||||
# please stop adding modify here its not here because it makes windows compilation take longer than geode 1.0 release date
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR
|
||||
"No valid loader binary to link to! Install pre-built binaries with `geode sdk install-binaries`, "
|
||||
"or build Geode from source."
|
||||
)
|
||||
endif()
|
|
@ -1,94 +0,0 @@
|
|||
|
||||
# Code of Conduct
|
||||
|
||||
## Notes
|
||||
|
||||
As an open source project, our policies are based on a Code of Conduct. Please
|
||||
make sure you read it before using our services. We expect everyone to follow
|
||||
the guidelines presented in this document.
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, caste, color, religion, or sexual
|
||||
identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the overall
|
||||
community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or advances of
|
||||
any kind
|
||||
* Trolling (antagonistic, inflammatory, insincere behaviour), insulting or
|
||||
derogatory comments, and personal or political attacks
|
||||
* Threats of violence or violent acts towards others
|
||||
* Public or private harassment
|
||||
* Intentionally dead-naming or misgendering others
|
||||
* Publishing others' private information, such as a physical or email address,
|
||||
without their explicit permission
|
||||
* Gatekeeping others' access to mental health or accessibility tools
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful. Actions may range from a warning to permanent removal from the
|
||||
community.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official email address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders directly on Discord, or via a private message
|
||||
to the official Geode X account ([@GeodeSDK](https://x.com/GeodeSDK)). If your report concerns a specific
|
||||
community team member or group of community team members, please send your
|
||||
report to a team member that is not part of the report, or a member of the
|
||||
administrative board.
|
||||
|
||||
All complaints will be reviewed and investigated promptly and fairly. All
|
||||
community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Changes & Feedback
|
||||
|
||||
Since the world is a dynamic place, this Code of Conduct may need changes. We
|
||||
reserve the right to update this Code of Conduct at any time.
|
||||
|
||||
We welcome feedback and suggestions. Feel free to open an issue on our
|
||||
[GitHub](https://github.com/geode-sdk/geode).
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html), with inspirations taken from [Prism Launcher Code of Conduct](https://prismlauncher.org/wiki/overview/code-of-conduct/) and [QuiltMC Code of Conduct](https://quiltmc.org/en/community/code-of-conduct/).
|
101
EULA
101
EULA
|
@ -1,101 +0,0 @@
|
|||
============================================
|
||||
End User License Agreement for Geode
|
||||
============================================
|
||||
|
||||
This is the End User License Agreement for the Geode Software. By using this Software, you agree to the terms of this EULA.
|
||||
|
||||
============================================
|
||||
1.0. Definitions
|
||||
============================================
|
||||
|
||||
The Software is all of the source code within the Geode (geode-sdk) Organization on GitHub that when put in a funky little blender and mashed together form the compiled Geode libraries and runtime binaries along with any additional side dishes such as the documentation website.
|
||||
|
||||
The Geode Team is the term used to refer to the developers of this Software. However, depending on context, it may refer to either only The Core Geode Team (people who are members of the geode-sdk Github Organization), or literally anyone who has ever contributed even a morsel of code to the Software.
|
||||
|
||||
The End User is someone who is using Geode and Geode-based modifications. This is the only actually kind of important term to define here, alongside Modder. The End User does not refer to someone who uses Geode to create mods, it refers to someone who uses Geode to play Geometry Dash with mods.
|
||||
|
||||
A Modder is someone who is using Geode and its functions in order to develope their own extensions for Geometry Dash.
|
||||
|
||||
Geometry Dash is a game by RobTop Games. If you're using Geode, you probably know what it is. If you're an actual lawyer or something alike looking at this text document, why? How did we end up in this situation? Can you let us off the hook if we just give you some cute photos of catgirls?
|
||||
|
||||
============================================
|
||||
1.1. Your rights as an End User
|
||||
============================================
|
||||
|
||||
You are not allowed to not do anything you want to without your own written permission. You are required to stop before every step of using this Software and ponder to yourself: "Is a car with a trailer driving on railway tracks a train?" Failing to do this will result in absolutely no punishments whatsoever. Not because it isn't wrong, but because we simply do not care.
|
||||
|
||||
In all seriousness, there are a few things you are not permitted to use this Software for. These include:
|
||||
|
||||
* Use mods you have not legally acquired the rights to use.
|
||||
|
||||
* Use mods that actively harm Geometry Dash or its community.
|
||||
|
||||
* Take multiple candies from a bowl that says "Take One"
|
||||
|
||||
* Enhance the development of anything related to thermonuclear weapons.
|
||||
|
||||
There are also things you are permitted to use this Software for. These include:
|
||||
|
||||
* Use mods to enhance your experience of Geometry Dash.
|
||||
|
||||
* Use mods to worsen your experience of Geometry Dash. I mean, I'm not one to judge.
|
||||
|
||||
* Change mod load order in-game.
|
||||
|
||||
* Customize keybinds in-game.
|
||||
|
||||
* Advance the development of genetically engineered domestic catgirls. However, in case you do in fact find this Software beneficial in your quest to help humanity reach its ultimate goal of cute catgirls, you are *required* to let us know and let us come pet a catgirl every alternating Tuesday (unless the current Week is also divisible by 7).
|
||||
|
||||
Any act you might use this Software for that isn't explicitly listed in any of the above lists you must consult at least yourself to decide if it's okay to do. Do note that the Developers of this Software, i.e. The Core Geode Team, may, at any time, publicly announce other cases that you may / may not use this Software for, or exceptions to previous cases. In the case that that happens, you are required to - wow did I just use 'that' twice in a row? That's so cool - comply with whatever The Core Geode Team says. Unless it's Pie telling you not to use any libraries. Don't listen to Pie.
|
||||
|
||||
============================================
|
||||
1.2. Your rights as a Modder
|
||||
============================================
|
||||
|
||||
This section mostly lists types of mods that you are allowed to and not allowed to make. Creating a mod that has features which are explicitly disallowed within this document will result in your mod being publicly shamed and humiliated. Be warned.
|
||||
|
||||
You are allowed to create mods that:
|
||||
|
||||
* Improve the general Geometry Dash experience.
|
||||
|
||||
* Extend the Geometry Dash experience.
|
||||
|
||||
* Are utterly useless. Ones that do absolutely nothing. We're not stopping you.
|
||||
|
||||
You are not allowed to create mods that:
|
||||
|
||||
* Spam the Geometry Dash servers with lots of unnecessary requests.
|
||||
|
||||
* Bypass and/or exploit useful moderation and/or community features, i.e. likebots, comment ban evasion tools, unlisted level scrapers, token grabbers, etc.
|
||||
|
||||
* Collect personal user data from End Users without their consent and/or knowledge.
|
||||
|
||||
* Actively harm the game.
|
||||
|
||||
* Go against the spirit of fun and games.
|
||||
|
||||
Anything not listed in the above lists may be okay to make, or it may not. Consult The Core Geode Team in case you aren't sure if a given mod is okay to make. It is also advised to communicate and discuss with other modders in the Geometry Dash modding community about any mods you are planning on creating which you are unsure about. It might be that your mod does more harm than good.
|
||||
|
||||
============================================
|
||||
1.3 Our rights
|
||||
============================================
|
||||
|
||||
We reserve the right to publicly shame and humiliate you for failing to understand our perfectly reasonable and unquestionable choices in the matters of design, code, public speaking, advertising, private speaking, behaviour, protected speaking, and anything else.
|
||||
|
||||
Our rights are your lefts. Because we are standing menacingly in front of you. Metaphorically speaking.
|
||||
|
||||
============================================
|
||||
1.4 Software
|
||||
============================================
|
||||
|
||||
I am tired of writing and I don't know what to write here. It's a mod loader and a modding SDK. You didn't download it not knowing what it is, did you?
|
||||
|
||||
============================================
|
||||
1.5 Too Long; Didn't Read
|
||||
============================================
|
||||
|
||||
* Geode is a mod loader & modding SDK for the game Geometry Dash.
|
||||
|
||||
* Don't make mods that could enable bad actors to do bad stuff.
|
||||
|
||||
* I want a catgirl.
|
23
LICENSE.txt
23
LICENSE.txt
|
@ -1,23 +0,0 @@
|
|||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
51
README.md
51
README.md
|
@ -1,51 +0,0 @@
|
|||
<p align="center">
|
||||
<img src="/title.png" />
|
||||
<h3 align="center">
|
||||
<a href="https://geode-sdk.org">Home page</a>
|
||||
</h3>
|
||||
</p>
|
||||
|
||||
<p align="center"><b>Geode</b> is a <a href="https://store.steampowered.com/app/322170/Geometry_Dash/">Geometry Dash</a> <b>mod loader</b> and <b>modding SDK</b> with a modern approach towards mod development.</p>
|
||||
|
||||
## Why Geode?
|
||||
|
||||
Unlike previous mod loaders, which merely inject the DLLs and let devs handle the rest, Geode aims to be a more comprehensive project that provides all the tools needed for creating mods in one package.
|
||||
|
||||
Geode's goal is to solve **mod incompatibility** - to ensure that mods work together without buttons getting misplaced or hooks mysteriously disappearing.
|
||||
|
||||
## "Hello World!" Example
|
||||
|
||||
Here's a **Hello World** mod in Geode:
|
||||
|
||||
```cpp
|
||||
#include <Geode/Bindings.hpp>
|
||||
#include <Geode/modify/MenuLayer.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
class $modify(MenuLayer) {
|
||||
void onMoreGames(CCObject*) {
|
||||
FLAlertLayer::create(
|
||||
"Geode",
|
||||
"Hello World from my Custom Mod!",
|
||||
"OK"
|
||||
)->show();
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
This code modifies what happens when the "More Games" button is clicked on the home scene in Geometry Dash, showing a custom popup.
|
||||
|
||||
## Documentation
|
||||
|
||||
Detailed documentation, tutorials, and installation instructions on using Geode can be found [here](https://docs.geode-sdk.org).
|
||||
|
||||
New to modding GD? Geode's documentation also comes with a handy [tutorial book](https://docs.geode-sdk.org/#/handbook/chap0) that explains all the basics of GD modding!
|
||||
|
||||
## Contribution
|
||||
|
||||
You can contribute to Geode by opening a [Pull Request](https://github.com/geode-sdk/geode/pulls)! Please follow the contribution guidelines.
|
||||
|
||||
## Questions, help, etc.
|
||||
|
||||
If you have any further questions, need help, or just want to share your love for catgirls, be sure to join [our Discord server](https://discord.gg/9e43WMKzhp)!
|
1
VERSION
1
VERSION
|
@ -1 +0,0 @@
|
|||
4.3.1
|
|
@ -1,24 +0,0 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors
|
||||
|
||||
set(CPM_DOWNLOAD_VERSION 0.40.2)
|
||||
set(CPM_HASH_SUM "c8cdc32c03816538ce22781ed72964dc864b2a34a310d3b7104812a5ca2d835d")
|
||||
|
||||
if(CPM_SOURCE_CACHE)
|
||||
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
|
||||
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||
else()
|
||||
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||
endif()
|
||||
|
||||
# Expand relative path. This is important if the provided path contains a tilde (~)
|
||||
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)
|
||||
|
||||
file(DOWNLOAD
|
||||
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
|
||||
${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM}
|
||||
)
|
||||
|
||||
include(${CPM_DOWNLOAD_LOCATION})
|
|
@ -1,416 +0,0 @@
|
|||
set(GEODE_CLI_MINIMUM_VERSION 1.0.5)
|
||||
|
||||
# Find Geode CLI
|
||||
if (NOT DEFINED GEODE_CLI OR GEODE_CLI STREQUAL "GEODE_CLI-NOTFOUND")
|
||||
find_program(GEODE_CLI NAMES geode.exe geode-cli.exe geode geode-cli PATHS ${CLI_PATH})
|
||||
endif()
|
||||
|
||||
# Check if CLI was found
|
||||
if (GEODE_CLI STREQUAL "GEODE_CLI-NOTFOUND")
|
||||
message(WARNING "Unable to find Geode CLI")
|
||||
else()
|
||||
# `geode --version` returns `geode x.x.x\n` so gotta do some wacky shit
|
||||
execute_process(
|
||||
COMMAND ${GEODE_CLI} --version
|
||||
OUTPUT_VARIABLE GEODE_CLI_VERSION
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
# Remove trailing newline
|
||||
string(STRIP ${GEODE_CLI_VERSION} GEODE_CLI_VERSION)
|
||||
# Remove program name
|
||||
string(REPLACE "geode " "" GEODE_CLI_VERSION ${GEODE_CLI_VERSION})
|
||||
|
||||
# Need at least v1.0.5 (--shut-up arg in geode package resources)
|
||||
if (${GEODE_CLI_VERSION} VERSION_LESS ${GEODE_CLI_MINIMUM_VERSION})
|
||||
message(FATAL_ERROR
|
||||
"Found Geode CLI: ${GEODE_CLI}, however it is version ${GEODE_CLI_VERSION} "
|
||||
"while minimum required is version ${GEODE_CLI_MINIMUM_VERSION}. Please update: "
|
||||
"https://github.com/geode-sdk/cli/releases/latest"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Cache version so it's available to other functions
|
||||
set(GEODE_CLI_VERSION "${GEODE_CLI_VERSION}" CACHE INTERNAL "GEODE_CLI_VERSION")
|
||||
|
||||
message(STATUS "Found Geode CLI: ${GEODE_CLI} (version ${GEODE_CLI_VERSION})")
|
||||
endif()
|
||||
|
||||
# Clear cache of mods being built so mods from earlier
|
||||
# configures dont appear on the list
|
||||
set(GEODE_MODS_BEING_BUILT "" CACHE INTERNAL "GEODE_MODS_BEING_BUILT")
|
||||
|
||||
# todo: add EXTERNAL argument that takes a list of external mod ids
|
||||
# current workaround is to manually append to GEODE_MODS_BEING_BUILT before
|
||||
# calling setup_geode_mod if the mod depends on external dependencies that
|
||||
# aren't being built
|
||||
function(setup_geode_mod proname)
|
||||
# Get DONT_INSTALL argument
|
||||
set(options DONT_INSTALL)
|
||||
set(multiValueArgs EXTERNALS)
|
||||
cmake_parse_arguments(SETUP_GEODE_MOD "${options}" "" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
# Link Geode to the mod
|
||||
target_link_libraries(${proname} geode-sdk)
|
||||
|
||||
if (ANDROID)
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
add_custom_command(
|
||||
TARGET "${proname}" POST_BUILD
|
||||
DEPENDS "${proname}"
|
||||
COMMAND $<$<CONFIG:release>:${CMAKE_STRIP}>
|
||||
ARGS -S $<TARGET_FILE:${proname}>
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (GEODE_DISABLE_CLI_CALLS)
|
||||
message("Skipping setting up geode mod ${proname}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(GEODE_CLI STREQUAL "GEODE_CLI-NOTFOUND")
|
||||
message(FATAL_ERROR
|
||||
"setup_geode_mod called, but Geode CLI was not found - "
|
||||
"Please install CLI: https://docs.geode-sdk.org/"
|
||||
)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# what is this for
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mod.json ${CMAKE_CURRENT_BINARY_DIR}/what.txt)
|
||||
set_target_properties(${proname} PROPERTIES CMAKE_CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/mod.json)
|
||||
|
||||
message(STATUS "Setting up ${proname}")
|
||||
|
||||
# Read mod.json
|
||||
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/mod.json" MOD_JSON)
|
||||
string(JSON MOD_ID GET "${MOD_JSON}" "id")
|
||||
string(JSON MOD_VERSION GET "${MOD_JSON}" "version")
|
||||
string(JSON TARGET_GEODE_VERSION GET "${MOD_JSON}" "geode")
|
||||
string(JSON MOD_HAS_API ERROR_VARIABLE MOD_DOESNT_HAVE_API GET "${MOD_JSON}" "api")
|
||||
string(JSON MOD_HAS_DEPS ERROR_VARIABLE MOD_DOESNT_HAVE_DEPS GET "${MOD_JSON}" "dependencies")
|
||||
|
||||
string(REGEX REPLACE "([0-9]+\\.[0-9]+)\\.[0-9]+" "\\1" TARGET_GEODE_VERSION_SHORT ${TARGET_GEODE_VERSION})
|
||||
string(REGEX REPLACE "([0-9]+\\.[0-9]+)\\.[0-9]+" "\\1" GEODE_VERSION_SHORT ${GEODE_VERSION_FULL})
|
||||
|
||||
if ("${TARGET_GEODE_VERSION_SHORT}" STREQUAL "${GEODE_VERSION_SHORT}")
|
||||
message(STATUS "Mod ${MOD_ID} is compiling for Geode version ${GEODE_VERSION_FULL}")
|
||||
else()
|
||||
message(FATAL_ERROR
|
||||
"Mod ${MOD_ID} is made for Geode version ${TARGET_GEODE_VERSION} but you have ${GEODE_VERSION_FULL} SDK installed. Please change the Geode version in your mod.json. "
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${proname} PRIVATE GEODE_MOD_ID="${MOD_ID}")
|
||||
|
||||
# Add this mod to the list of known externals mods
|
||||
list(APPEND GEODE_MODS_BEING_BUILT "${MOD_ID}:${MOD_VERSION}")
|
||||
# Ensure that the list of mods being built is global (persists between setup_geode_mod calls)
|
||||
set(GEODE_MODS_BEING_BUILT ${GEODE_MODS_BEING_BUILT} CACHE INTERNAL "GEODE_MODS_BEING_BUILT")
|
||||
|
||||
# Add function arg externals to the list but don't cache that
|
||||
if (SETUP_GEODE_MOD_EXTERNALS)
|
||||
list(APPEND GEODE_MODS_BEING_BUILT ${SETUP_GEODE_MOD_EXTERNALS})
|
||||
endif()
|
||||
|
||||
# For CLI >=v2.4.0, there's an option to disable updating index because
|
||||
# Github Actions on Mac just returns 403 for no reason
|
||||
if (GEODE_DONT_UPDATE_INDEX AND (${GEODE_CLI_VERSION} VERSION_GREATER_EQUAL "2.4.0"))
|
||||
set(DONT_UPDATE_INDEX_ARG "--dont-update-index")
|
||||
else()
|
||||
set(DONT_UPDATE_INDEX_ARG "")
|
||||
endif()
|
||||
|
||||
# Check dependencies using CLI
|
||||
if (${GEODE_CLI_VERSION} VERSION_GREATER_EQUAL "3.2.0")
|
||||
execute_process(
|
||||
COMMAND ${GEODE_CLI} project check ${CMAKE_CURRENT_BINARY_DIR}
|
||||
--externals ${GEODE_MODS_BEING_BUILT} ${DONT_UPDATE_INDEX_ARG}
|
||||
--platform ${GEODE_TARGET_PLATFORM_SHORT}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
elseif (${GEODE_CLI_VERSION} VERSION_GREATER_EQUAL "2.0.0")
|
||||
message(WARNING "If you use platform-specific dependencies, upgrade Geode CLI to version 3.2.0 or greater!")
|
||||
execute_process(
|
||||
COMMAND ${GEODE_CLI} project check ${CMAKE_CURRENT_BINARY_DIR}
|
||||
--externals ${GEODE_MODS_BEING_BUILT} ${DONT_UPDATE_INDEX_ARG}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
elseif (${GEODE_CLI_VERSION} VERSION_GREATER_EQUAL "1.4.0")
|
||||
execute_process(
|
||||
COMMAND ${GEODE_CLI} package setup ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
||||
--externals ${GEODE_MODS_BEING_BUILT}
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
elseif (MOD_HAS_DEPS)
|
||||
message(FATAL_ERROR
|
||||
"CLI is version ${GEODE_CLI_VERSION}, but using dependencies "
|
||||
"requires at least 1.4.0 - please update your CLI"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Check if --install should be passed
|
||||
if (SETUP_GEODE_MOD_DONT_INSTALL OR GEODE_DONT_INSTALL_MODS)
|
||||
message(STATUS "Skipping installing ${proname}")
|
||||
set(INSTALL_ARG "")
|
||||
else()
|
||||
set(INSTALL_ARG "--install")
|
||||
endif()
|
||||
|
||||
# The lib binary should be passed only if some headers were provided
|
||||
if (MOD_HAS_API)
|
||||
message(STATUS "Including library & headers with ${proname}")
|
||||
set(HAS_HEADERS On)
|
||||
else()
|
||||
set(HAS_HEADERS Off)
|
||||
endif()
|
||||
|
||||
if (GEODE_BUNDLE_PDB AND WIN32 AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
|
||||
if (HAS_HEADERS)
|
||||
add_custom_target(${proname}_PACKAGE ALL
|
||||
DEPENDS ${proname} ${CMAKE_CURRENT_SOURCE_DIR}/mod.json
|
||||
COMMAND ${GEODE_CLI} package new ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
--binary $<TARGET_FILE:${proname}> $<TARGET_LINKER_FILE:${proname}> $<TARGET_PDB_FILE:${proname}>
|
||||
--output ${CMAKE_CURRENT_BINARY_DIR}/${MOD_ID}.geode
|
||||
${INSTALL_ARG} ${PDB_ARG}
|
||||
VERBATIM USES_TERMINAL
|
||||
)
|
||||
else()
|
||||
add_custom_target(${proname}_PACKAGE ALL
|
||||
DEPENDS ${proname} ${CMAKE_CURRENT_SOURCE_DIR}/mod.json
|
||||
COMMAND ${GEODE_CLI} package new ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
--binary $<TARGET_FILE:${proname}> $<TARGET_PDB_FILE:${proname}>
|
||||
--output ${CMAKE_CURRENT_BINARY_DIR}/${MOD_ID}.geode
|
||||
${INSTALL_ARG} ${PDB_ARG}
|
||||
VERBATIM USES_TERMINAL
|
||||
)
|
||||
endif()
|
||||
elseif (HAS_HEADERS AND WIN32)
|
||||
# this adds the .lib file on windows, which is needed for linking with the headers
|
||||
add_custom_target(${proname}_PACKAGE ALL
|
||||
DEPENDS ${proname} ${CMAKE_CURRENT_SOURCE_DIR}/mod.json
|
||||
COMMAND ${GEODE_CLI} package new ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
--binary $<TARGET_FILE:${proname}> $<TARGET_LINKER_FILE:${proname}>
|
||||
--output ${CMAKE_CURRENT_BINARY_DIR}/${MOD_ID}.geode
|
||||
${INSTALL_ARG}
|
||||
VERBATIM USES_TERMINAL
|
||||
)
|
||||
else()
|
||||
add_custom_target(${proname}_PACKAGE ALL
|
||||
DEPENDS ${proname} ${CMAKE_CURRENT_SOURCE_DIR}/mod.json
|
||||
COMMAND ${GEODE_CLI} package new ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
--binary $<TARGET_FILE:${proname}>
|
||||
--output ${CMAKE_CURRENT_BINARY_DIR}/${MOD_ID}.geode
|
||||
${INSTALL_ARG}
|
||||
VERBATIM USES_TERMINAL
|
||||
)
|
||||
endif()
|
||||
|
||||
# Add dependency dir to include path
|
||||
if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/geode-deps")
|
||||
|
||||
file(GLOB dirs ${CMAKE_CURRENT_BINARY_DIR}/geode-deps/*)
|
||||
|
||||
set(libs_to_link "")
|
||||
|
||||
# Iterate dependency directories
|
||||
foreach(dir ${dirs})
|
||||
if (IS_DIRECTORY ${dir})
|
||||
|
||||
# v1.4.1 fixes optional dependencies
|
||||
if (${GEODE_CLI_VERSION} VERSION_GREATER_EQUAL "1.4.1")
|
||||
# Read dep info
|
||||
file(READ "${dir}/geode-dep-options.json" DEP_JSON)
|
||||
string(JSON required GET "${DEP_JSON}" "required")
|
||||
|
||||
# If this is not a required dependency, don't link it
|
||||
if (NOT ${required})
|
||||
continue()
|
||||
endif()
|
||||
else()
|
||||
message(WARNING
|
||||
"You are using CLI v1.4.0, which has a bug with optional "
|
||||
"dependencies - update to v1.4.1 if you want to use "
|
||||
"optional dependencies!"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Otherwise add all .libs or whatever the platform's library type is
|
||||
if (WIN32 OR LINUX)
|
||||
file(GLOB libs ${dir}/*.lib)
|
||||
list(APPEND libs_to_link ${libs})
|
||||
elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS")
|
||||
file(GLOB libs ${dir}/*.ios.dylib)
|
||||
list(APPEND libs_to_link ${libs})
|
||||
elseif (APPLE)
|
||||
file(GLOB libs ${dir}/*.dylib)
|
||||
file(GLOB ios_libs ${dir}/*.ios.dylib)
|
||||
list(REMOVE_ITEM libs ${ios_libs})
|
||||
list(APPEND libs_to_link ${libs})
|
||||
elseif (ANDROID)
|
||||
if (CMAKE_ANDROID_ARCH_ABI STREQUAL "arm64-v8a")
|
||||
file(GLOB libs ${dir}/*.android64.so)
|
||||
else()
|
||||
file(GLOB libs ${dir}/*.android32.so)
|
||||
endif()
|
||||
list(APPEND libs_to_link ${libs})
|
||||
else()
|
||||
message(FATAL_ERROR "Library extension not defined on this platform")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Link libs
|
||||
target_include_directories(${proname} PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/geode-deps")
|
||||
target_link_libraries(${proname} ${libs_to_link})
|
||||
|
||||
endif()
|
||||
|
||||
# Add package target + make output name the mod id
|
||||
set_target_properties(${proname} PROPERTIES PREFIX "")
|
||||
if (DEFINED GEODE_MOD_BINARY_SUFFIX)
|
||||
set_target_properties(${proname} PROPERTIES SUFFIX ${GEODE_MOD_BINARY_SUFFIX})
|
||||
endif()
|
||||
set_target_properties(${proname} PROPERTIES OUTPUT_NAME ${MOD_ID})
|
||||
endfunction()
|
||||
|
||||
function(create_geode_file proname)
|
||||
# todo: deprecate at some point ig
|
||||
# message(DEPRECATION
|
||||
# "create_geode_file has been replaced with setup_geode_mod - "
|
||||
# "please replace the function call"
|
||||
# )
|
||||
|
||||
# forward all args
|
||||
setup_geode_mod(${proname} ${ARGN})
|
||||
endfunction()
|
||||
|
||||
function(package_geode_resources proname src dest)
|
||||
if (GEODE_DISABLE_CLI_CALLS)
|
||||
message("Skipping packaging resources from ${src} into ${dest}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(STATUS "Packaging resources from ${src} into ${dest}")
|
||||
|
||||
if(GEODE_CLI STREQUAL "GEODE_CLI-NOTFOUND")
|
||||
message(WARNING
|
||||
"package_geode_resources called, but Geode CLI was "
|
||||
"not found - You will need to manually package the resources"
|
||||
)
|
||||
else()
|
||||
|
||||
add_custom_target(${proname}_PACKAGE ALL
|
||||
DEPENDS ${proname}
|
||||
COMMAND ${GEODE_CLI} package resources ${src} ${dest}
|
||||
VERBATIM USES_TERMINAL
|
||||
)
|
||||
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(package_geode_resources_now proname src dest header_dest)
|
||||
if (GEODE_DISABLE_CLI_CALLS)
|
||||
message(WARNING
|
||||
"package_geode_resources_now called, but GEODE_DISABLE_CLI_CALLS
|
||||
is set to true - Faking output result in case you only wish to
|
||||
analyze the project statically, do not expect built project to
|
||||
function properly"
|
||||
)
|
||||
set(HEADER_FILE
|
||||
"#include <unordered_map>\n\n"
|
||||
"static const std::unordered_map<std::string, std::string> "
|
||||
"LOADER_RESOURCE_HASHES {}\;\n"
|
||||
)
|
||||
file(WRITE ${header_dest} ${HEADER_FILE})
|
||||
message(STATUS "Wrote fake resource hashes to ${header_dest}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(GEODE_CLI STREQUAL "GEODE_CLI-NOTFOUND")
|
||||
message(FATAL_ERROR
|
||||
"package_geode_resources_now called, but Geode CLI "
|
||||
"was not found - Please install Geode CLI from "
|
||||
"https://github.com/geode-sdk/cli/releases/latest"
|
||||
)
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(STATUS "Packaging resources now from ${src} into ${dest}")
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GEODE_CLI} package resources ${src} ${dest} --shut-up
|
||||
RESULT_VARIABLE GEODE_PACKAGE_RES
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
|
||||
if (NOT GEODE_PACKAGE_RES EQUAL "0")
|
||||
message(FATAL_ERROR
|
||||
"Command \"${GEODE_CLI} package resources ${src} ${dest}\" returned "
|
||||
"${GEODE_PACKAGE_RES} - Expected 0"
|
||||
)
|
||||
endif()
|
||||
|
||||
file(GLOB RESOURCE_FILES "${dest}/*.*")
|
||||
|
||||
set(HEADER_FILE
|
||||
"#include <unordered_map>\n\n"
|
||||
"static const std::unordered_map<std::string, std::string> "
|
||||
"LOADER_RESOURCE_HASHES {\n"
|
||||
# "#include <vector>\n\n"
|
||||
# "static const std::vector<std::string> "
|
||||
# "LOADER_RESOURCE_FILES {\n"
|
||||
)
|
||||
|
||||
# yeah don't think we need to check too many stuff
|
||||
# list(APPEND HASHED_EXTENSIONS ".png")
|
||||
# list(APPEND HASHED_EXTENSIONS ".mp3")
|
||||
# list(APPEND HASHED_EXTENSIONS ".ogg")
|
||||
list(APPEND HASHED_TEXT_EXTENSIONS ".md")
|
||||
|
||||
foreach(file ${RESOURCE_FILES})
|
||||
cmake_path(GET file FILENAME FILE_NAME)
|
||||
get_filename_component(FILE_EXTENSION ${file} EXT)
|
||||
|
||||
list(FIND HASHED_EXTENSIONS "${FILE_EXTENSION}" FILE_SHOULD_HASH)
|
||||
|
||||
if (NOT FILE_NAME STREQUAL ".geode_cache" AND NOT FILE_SHOULD_HASH EQUAL -1)
|
||||
|
||||
file(SHA256 ${file} COMPUTED_HASH)
|
||||
file(SIZE ${file} FILE_SIZE)
|
||||
message(STATUS "Hashed ${file} to ${COMPUTED_HASH} (${FILE_SIZE} bytes)")
|
||||
list(APPEND HEADER_FILE "\t{ \"${FILE_NAME}\", \"${COMPUTED_HASH}\" },\n")
|
||||
|
||||
# list(APPEND HEADER_FILE "\t\"${FILE_NAME}\",\n")
|
||||
|
||||
endif()
|
||||
|
||||
list(FIND HASHED_TEXT_EXTENSIONS "${FILE_EXTENSION}" FILE_SHOULD_TEXT_HASH)
|
||||
|
||||
if (NOT FILE_NAME STREQUAL ".geode_cache" AND NOT FILE_SHOULD_TEXT_HASH EQUAL -1)
|
||||
|
||||
# create list of lines form the contens of a file
|
||||
file(STRINGS ${file} LINES)
|
||||
list(JOIN LINES "" JOINED)
|
||||
# compute hash of the lines
|
||||
string(LENGTH "${JOINED}" FILE_SIZE)
|
||||
string(SHA256 COMPUTED_HASH "${JOINED}")
|
||||
|
||||
message(STATUS "Hashed ${file} to ${COMPUTED_HASH} (${FILE_SIZE} bytes)")
|
||||
list(APPEND HEADER_FILE "\t{ \"${FILE_NAME}\", \"${COMPUTED_HASH}\" },\n")
|
||||
|
||||
# list(APPEND HEADER_FILE "\t\"${FILE_NAME}\",\n")
|
||||
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
list(APPEND HEADER_FILE "}\;\n")
|
||||
|
||||
file(WRITE ${header_dest} ${HEADER_FILE})
|
||||
message(STATUS "Wrote resource hashes to ${header_dest}")
|
||||
|
||||
endfunction()
|
|
@ -1,204 +0,0 @@
|
|||
include(cmake/PlatformDetect.cmake)
|
||||
|
||||
if (NOT ${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
|
||||
set(GEODE_TARGET_PLATFORM GEODE_TARGET_PLATFORM PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
if (GEODE_TARGET_PLATFORM STREQUAL "iOS")
|
||||
# make sure that we get the ios sdk
|
||||
execute_process(COMMAND xcrun --show-sdk-path --sdk iphoneos
|
||||
OUTPUT_VARIABLE GEODE_IOS_SDK
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
message(STATUS "iOS c++ compiler: ${CMAKE_CXX_COMPILER}")
|
||||
set(CMAKE_OSX_ARCHITECTURES arm64)
|
||||
set(CMAKE_OSX_SYSROOT ${GEODE_IOS_SDK})
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "14.0")
|
||||
set(CMAKE_SYSTEM_NAME "iOS")
|
||||
|
||||
# this fails on ios builds
|
||||
set(BUILD_MD2HTML_EXECUTABLE "OFF")
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
SYSTEM_NAME iOS
|
||||
OSX_SYSROOT ${GEODE_IOS_SDK}
|
||||
OSX_ARCHITECTURES arm64
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} INTERFACE
|
||||
"-framework OpenGLES" # needed for CCClippingNode reimpl and ScrollLayer
|
||||
"-framework UIKit" # needed for file picking (UIApplication)
|
||||
"-framework Foundation" # needed for many things
|
||||
"-framework AVFoundation" # needed for fmod
|
||||
"-framework AudioToolbox" # needed for fmod
|
||||
${GEODE_LOADER_PATH}/include/link/ios/libcurl.a
|
||||
${GEODE_LOADER_PATH}/include/link/ios/libfmod_iphoneos.a
|
||||
)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} INTERFACE
|
||||
-DCommentType=CommentTypeDummy
|
||||
)
|
||||
|
||||
set(GEODE_OUTPUT_NAME "Geode.ios")
|
||||
set(GEODE_PLATFORM_BINARY "Geode.ios.dylib")
|
||||
set(GEODE_MOD_BINARY_SUFFIX ".ios.dylib" CACHE STRING "" FORCE)
|
||||
|
||||
if (NOT ${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "ios" PARENT_SCOPE)
|
||||
# this is needed because else loading mods will fail below ios 14.5
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "14.0" PARENT_SCOPE)
|
||||
else()
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "ios")
|
||||
endif()
|
||||
elseif (GEODE_TARGET_PLATFORM STREQUAL "MacOS")
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
SYSTEM_NAME MacOS
|
||||
)
|
||||
|
||||
# for some reason, this value is initialized as an empty string by default. idk why
|
||||
if (NOT DEFINED CMAKE_OSX_ARCHITECTURES OR CMAKE_OSX_ARCHITECTURES STREQUAL "")
|
||||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
|
||||
endif()
|
||||
|
||||
# only exists as a global property
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} INTERFACE
|
||||
"-framework Cocoa"
|
||||
"-framework OpenGL"
|
||||
"-framework SystemConfiguration"
|
||||
${GEODE_LOADER_PATH}/include/link/macos/libfmod.dylib
|
||||
${GEODE_LOADER_PATH}/include/link/macos/libssl.a
|
||||
${GEODE_LOADER_PATH}/include/link/macos/libcrypto.a
|
||||
${GEODE_LOADER_PATH}/include/link/macos/libnghttp2.a
|
||||
${GEODE_LOADER_PATH}/include/link/macos/libngtcp2.a
|
||||
${GEODE_LOADER_PATH}/include/link/macos/libnghttp3.a
|
||||
${GEODE_LOADER_PATH}/include/link/macos/libngtcp2_crypto_boringssl.a
|
||||
${GEODE_LOADER_PATH}/include/link/macos/libcurl.a
|
||||
)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} INTERFACE
|
||||
-DCommentType=CommentTypeDummy
|
||||
-DGL_SILENCE_DEPRECATION
|
||||
)
|
||||
|
||||
set(GEODE_OUTPUT_NAME "Geode")
|
||||
set(GEODE_PLATFORM_BINARY "Geode.dylib")
|
||||
set(GEODE_MOD_BINARY_SUFFIX ".dylib" CACHE STRING "" FORCE)
|
||||
|
||||
if (NOT ${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "mac" PARENT_SCOPE)
|
||||
else()
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "mac")
|
||||
endif()
|
||||
elseif (GEODE_TARGET_PLATFORM STREQUAL "Win64")
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
SYSTEM_NAME Win64
|
||||
GENERATOR_PLATFORM x64
|
||||
)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} INTERFACE NOMINMAX)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} INTERFACE
|
||||
${GEODE_LOADER_PATH}/include/link/win64/libcocos2d.lib
|
||||
${GEODE_LOADER_PATH}/include/link/win64/libExtensions.lib
|
||||
${GEODE_LOADER_PATH}/include/link/win64/glew32.lib
|
||||
${GEODE_LOADER_PATH}/include/link/win64/fmod.lib
|
||||
opengl32
|
||||
)
|
||||
|
||||
if (PROJECT_IS_TOP_LEVEL AND CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
target_link_libraries(${PROJECT_NAME} INTERFACE
|
||||
${GEODE_LOADER_PATH}/include/link/win64/gd-libcurl.lib
|
||||
)
|
||||
else()
|
||||
target_link_libraries(${PROJECT_NAME} INTERFACE
|
||||
${GEODE_LOADER_PATH}/include/link/win64/ssl.lib
|
||||
${GEODE_LOADER_PATH}/include/link/win64/crypto.lib
|
||||
${GEODE_LOADER_PATH}/include/link/win64/nghttp2.lib
|
||||
${GEODE_LOADER_PATH}/include/link/win64/ngtcp2.lib
|
||||
${GEODE_LOADER_PATH}/include/link/win64/nghttp3.lib
|
||||
${GEODE_LOADER_PATH}/include/link/win64/ngtcp2_crypto_boringssl.lib
|
||||
${GEODE_LOADER_PATH}/include/link/win64/libcurl.lib
|
||||
)
|
||||
endif()
|
||||
|
||||
# Windows links against .lib and not .dll
|
||||
set(GEODE_OUTPUT_NAME "Geode")
|
||||
set(GEODE_PLATFORM_BINARY "Geode.lib")
|
||||
set(GEODE_MOD_BINARY_SUFFIX ".dll" CACHE STRING "" FORCE)
|
||||
|
||||
if (NOT ${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "win" PARENT_SCOPE)
|
||||
else()
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "win")
|
||||
endif()
|
||||
elseif (GEODE_TARGET_PLATFORM STREQUAL "Android32")
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
SYSTEM_NAME Android
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} INTERFACE
|
||||
c
|
||||
unwind
|
||||
${GEODE_LOADER_PATH}/include/link/android32/libssl.a
|
||||
${GEODE_LOADER_PATH}/include/link/android32/libcrypto.a
|
||||
${GEODE_LOADER_PATH}/include/link/android32/libnghttp2.a
|
||||
${GEODE_LOADER_PATH}/include/link/android32/libngtcp2.a
|
||||
${GEODE_LOADER_PATH}/include/link/android32/libnghttp3.a
|
||||
${GEODE_LOADER_PATH}/include/link/android32/libngtcp2_crypto_boringssl.a
|
||||
${GEODE_LOADER_PATH}/include/link/android32/libcurl.a
|
||||
${GEODE_LOADER_PATH}/include/link/android32/libcocos2dcpp.so
|
||||
${GEODE_LOADER_PATH}/include/link/android32/libfmod.so
|
||||
GLESv2
|
||||
log
|
||||
)
|
||||
|
||||
set(GEODE_OUTPUT_NAME "Geode.android32")
|
||||
set(GEODE_PLATFORM_BINARY "Geode.android32.so")
|
||||
set(GEODE_MOD_BINARY_SUFFIX ".android32.so" CACHE STRING "" FORCE)
|
||||
|
||||
if (NOT ${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "android32" PARENT_SCOPE)
|
||||
else()
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "android32")
|
||||
endif()
|
||||
elseif (GEODE_TARGET_PLATFORM STREQUAL "Android64")
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
SYSTEM_NAME Android
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} INTERFACE
|
||||
c
|
||||
unwind
|
||||
${GEODE_LOADER_PATH}/include/link/android64/libssl.a
|
||||
${GEODE_LOADER_PATH}/include/link/android64/libcrypto.a
|
||||
${GEODE_LOADER_PATH}/include/link/android64/libnghttp2.a
|
||||
${GEODE_LOADER_PATH}/include/link/android64/libngtcp2.a
|
||||
${GEODE_LOADER_PATH}/include/link/android64/libnghttp3.a
|
||||
${GEODE_LOADER_PATH}/include/link/android64/libngtcp2_crypto_boringssl.a
|
||||
${GEODE_LOADER_PATH}/include/link/android64/libcurl.a
|
||||
${GEODE_LOADER_PATH}/include/link/android64/libcocos2dcpp.so
|
||||
${GEODE_LOADER_PATH}/include/link/android64/libfmod.so
|
||||
GLESv2
|
||||
log
|
||||
)
|
||||
|
||||
# this should help with fixing exceptions
|
||||
set(ANDROID_STL c++_shared)
|
||||
# a little desperate
|
||||
add_definitions(-DANDROID_STL=c++_shared)
|
||||
|
||||
set(GEODE_OUTPUT_NAME "Geode.android64")
|
||||
set(GEODE_PLATFORM_BINARY "Geode.android64.so")
|
||||
set(GEODE_MOD_BINARY_SUFFIX ".android64.so" CACHE STRING "" FORCE)
|
||||
|
||||
if (NOT ${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "android64" PARENT_SCOPE)
|
||||
else()
|
||||
set(GEODE_TARGET_PLATFORM_SHORT "android64")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown platform ${GEODE_TARGET_PLATFORM}")
|
||||
endif()
|
|
@ -1,19 +0,0 @@
|
|||
if (NOT DEFINED GEODE_TARGET_PLATFORM)
|
||||
if(APPLE)
|
||||
if("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS" OR IOS)
|
||||
set(GEODE_TARGET_PLATFORM "iOS")
|
||||
else()
|
||||
set(GEODE_TARGET_PLATFORM "MacOS")
|
||||
endif()
|
||||
elseif(WIN32)
|
||||
set(GEODE_TARGET_PLATFORM "Win64")
|
||||
elseif(ANDROID)
|
||||
if (ANDROID_ABI STREQUAL "arm64-v8a")
|
||||
set(GEODE_TARGET_PLATFORM "Android64")
|
||||
elseif(ANDROID_ABI STREQUAL "armeabi-v7a")
|
||||
set(GEODE_TARGET_PLATFORM "Android32")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Unable to detect platform, please set GEODE_TARGET_PLATFORM in the root CMake file.")
|
||||
endif()
|
||||
endif()
|
54
entry.cpp
54
entry.cpp
|
@ -1,54 +0,0 @@
|
|||
#include <Geode/loader/Loader.hpp>
|
||||
#include <Geode/loader/Mod.hpp>
|
||||
|
||||
namespace geode {
|
||||
/**
|
||||
* To bypass the need for cyclic dependencies,
|
||||
* this function does the exact same as Mod::get()
|
||||
* However, it can be externed, unlike Mod::get()
|
||||
* @returns Same thing Mod::get() returns
|
||||
*/
|
||||
Mod* getMod() {
|
||||
return Mod::get();
|
||||
}
|
||||
}
|
||||
|
||||
GEODE_API void geodeImplicitEntry() {
|
||||
// to make sure the instance is set into the sharedMod<> in load time
|
||||
(void)geode::getMod();
|
||||
}
|
||||
|
||||
#if defined(_DEBUG) && defined(GEODE_IS_WINDOWS)
|
||||
|
||||
// This bypasses any of the heap validation measures that are injected when compiling in Debug.
|
||||
// Without these, the game will very likely crash when the mod tries to free memory allocated by the game (or another non-debug mod).
|
||||
|
||||
static inline void* relallocthrow(size_t size) {
|
||||
void* p;
|
||||
while ((p = HeapAlloc(GetProcessHeap(), 0, size)) == 0) {
|
||||
if (_callnewh(size) == 0) {
|
||||
static const std::bad_alloc exc;
|
||||
throw exc;
|
||||
}
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
static inline void relfree(void* block) {
|
||||
HeapFree(GetProcessHeap(), 0, block);
|
||||
}
|
||||
|
||||
void* operator new(size_t size) {
|
||||
return relallocthrow(size);
|
||||
}
|
||||
|
||||
void* operator new[](size_t size) {
|
||||
return relallocthrow(size);
|
||||
}
|
||||
|
||||
void operator delete(void* block) noexcept {
|
||||
relfree(block);
|
||||
}
|
||||
|
||||
#endif
|
101
flash.toml
101
flash.toml
|
@ -1,101 +0,0 @@
|
|||
|
||||
# Configuration file for the Flash C++ documentation generator.
|
||||
# https://github.com/geode-sdk/flash
|
||||
|
||||
[project]
|
||||
name = "Geode"
|
||||
version = "" # dont bother
|
||||
repository = "https://github.com/geode-sdk/geode"
|
||||
tree = "https://github.com/geode-sdk/geode/tree/main"
|
||||
icon = "loader/resources/logos/geode-circle.png"
|
||||
|
||||
[tutorials]
|
||||
dir = "docs"
|
||||
assets = [
|
||||
"docs/assets/*.png",
|
||||
"docs/assets/settings/*.png",
|
||||
"docs/assets/handbook/vol1/*.png",
|
||||
"docs/assets/handbook/vol2/*.png",
|
||||
]
|
||||
|
||||
[[external-libs]]
|
||||
pattern = "matjson"
|
||||
repository = "https://github.com/geode-sdk/json"
|
||||
|
||||
[[external-libs]]
|
||||
pattern = "Result.hpp"
|
||||
repository = "https://github.com/geode-sdk/result"
|
||||
|
||||
[[sources]]
|
||||
name = "Geode"
|
||||
dir = "loader/include"
|
||||
include = [
|
||||
"Geode/**/*.hpp",
|
||||
"Geode/**/*.h",
|
||||
]
|
||||
exclude = [
|
||||
"Geode/modify/Comparer.hpp",
|
||||
"Geode/platform/*.hpp",
|
||||
"Geode/c++stl/*.hpp",
|
||||
# All of the relevant cocos headers are included through Geode headers
|
||||
"Geode/cocos/**/*.h"
|
||||
]
|
||||
|
||||
[[sources]]
|
||||
name = "Bindings"
|
||||
dir = "build-docs/bindings/bindings"
|
||||
include = [
|
||||
"Geode/binding/*.hpp"
|
||||
]
|
||||
# Bindings are generated at compile time
|
||||
exists-online = false
|
||||
|
||||
[ignore]
|
||||
patterns-name = [
|
||||
# anything that starts with a double underscore
|
||||
# shouldnt be included
|
||||
"^__",
|
||||
"^tinyxml2$",
|
||||
"^format_as$",
|
||||
# operator overloads
|
||||
"^operator\\W"
|
||||
]
|
||||
patterns-full = [
|
||||
"^geode::modifier",
|
||||
"^geode::prelude",
|
||||
"^geode::stl",
|
||||
"^geode::geode_internal"
|
||||
]
|
||||
|
||||
# CMake options
|
||||
|
||||
[cmake]
|
||||
config-args = [
|
||||
"-G", "Ninja",
|
||||
"-DCMAKE_CXX_COMPILER=Clang",
|
||||
"-DCMAKE_C_COMPILER=Clang",
|
||||
"-DGEODE_BUILDING_DOCS=On",
|
||||
"-DGEODE_PLATFORM_NAME=Win64",
|
||||
"-DGEODE_CODEGEN_CMAKE_ARGS=-DCMAKE_CXX_COMPILER=Clang;-DCMAKE_C_COMPILER=Clang",
|
||||
"-DWIN32=On"
|
||||
]
|
||||
build-dir = "build-docs"
|
||||
|
||||
# The file we use to get all the include paths and such
|
||||
infer-args-from = "loader/src/load.cpp"
|
||||
|
||||
[[scripts.css]]
|
||||
name = "default.css"
|
||||
content = "docs/flash-template/default.css"
|
||||
|
||||
[[scripts.css]]
|
||||
name = "nav.css"
|
||||
content = "docs/flash-template/nav.css"
|
||||
|
||||
[[scripts.css]]
|
||||
name = "content.css"
|
||||
content = "docs/flash-template/content.css"
|
||||
|
||||
[[scripts.css]]
|
||||
name = "themes.css"
|
||||
content = "docs/flash-template/themes.css"
|
|
@ -1,128 +0,0 @@
|
|||
#!/usr/bin/env osascript
|
||||
|
||||
on ExitWithMessage(message)
|
||||
display dialog message
|
||||
do shell script "sudo rm -rf \"" & binPath & "\""
|
||||
error number -128
|
||||
end ExitWithMessage
|
||||
|
||||
set installerChoices to {"Install Geode", "Uninstall Geode"}
|
||||
|
||||
set installerAnswer to choose from list installerChoices with title "Geode" with prompt "What do you want to do?" default items "Install Geode"
|
||||
|
||||
if installerAnswer is false then
|
||||
ExitWithMessage ("Prompt cancelled.")
|
||||
else
|
||||
set installerAnswer to installerAnswer's item 1
|
||||
end if
|
||||
|
||||
set tmpPath to POSIX path of "/tmp/"
|
||||
set binPath to (tmpPath & "geode-install/")
|
||||
|
||||
tell application "System Events"
|
||||
try
|
||||
set libraryPath to POSIX path of (path to home folder from user domain)
|
||||
set steamPath to (libraryPath & "/Library/Application Support/Steam/steamapps/common/Geometry Dash/")
|
||||
|
||||
display dialog "Steam path: " & steamPath
|
||||
|
||||
if exists folder steamPath then
|
||||
set gdPath to (the POSIX path of (choose file with prompt "Please choose the Geometry Dash application to install Geode to:" of type {"app"} default location steamPath))
|
||||
else
|
||||
set gdPath to (the POSIX path of (choose file with prompt "Please choose the Geometry Dash application to install Geode to:" of type {"app"}))
|
||||
end if
|
||||
|
||||
set gdPath to (gdPath & "/")
|
||||
|
||||
on error
|
||||
ExitWithMessage ("Prompt cancelled.")
|
||||
end try
|
||||
|
||||
set execPath to (gdPath & "Contents/MacOS/Geometry Dash")
|
||||
set frameworkPath to (gdPath & "Contents/Frameworks/")
|
||||
set fmodPath to "libfmod.dylib"
|
||||
set fmodOriginalPath to "restore_fmod.dylib"
|
||||
set geodePath to "Geode.dylib"
|
||||
set bootstrapperPath to "GeodeBootstrapper.dylib"
|
||||
set resourcesPath to "resources/"
|
||||
set newGeodePath to "Contents/geode/"
|
||||
set newResourcesPath to (newGeodePath & "resources/geode.loader/")
|
||||
|
||||
try
|
||||
if not exists file execPath then
|
||||
ExitWithMessage ("Not a valid Geometry Dash installation (executable missing): " & gdPath)
|
||||
end if
|
||||
|
||||
if not exists file (frameworkPath & fmodPath) then
|
||||
ExitWithMessage ("Not a valid Geometry Dash installation (fmod missing): " & gdPath)
|
||||
end if
|
||||
on error
|
||||
ExitWithMessage ("Not a valid Geometry Dash installation: " & gdPath)
|
||||
end try
|
||||
end tell
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if installerAnswer is "Install Geode" then
|
||||
|
||||
try
|
||||
do shell script "mv -n \"" & (frameworkPath & fmodPath) & "\" \"" & (frameworkPath & fmodOriginalPath) & "\""
|
||||
on error
|
||||
ExitWithMessage ("Saving original fmod failed: " & (frameworkPath & fmodPath))
|
||||
end try
|
||||
|
||||
try
|
||||
do shell script "mv \"" & (binPath & geodePath) & "\" \"" & (frameworkPath & geodePath) & "\""
|
||||
do shell script "mv \"" & (binPath & bootstrapperPath) & "\" \"" & (frameworkPath & bootstrapperPath) & "\""
|
||||
do shell script "mv \"" & (binPath & fmodPath) & "\" \"" & (frameworkPath & fmodPath) & "\""
|
||||
do shell script "INSTALLER_USER=$(stat -f '%Su' $HOME) && chown -R $INSTALLER_USER \"" & frameworkPath & "\""
|
||||
on error
|
||||
ExitWithMessage ("Moving libraries failed: " & frameworkPath)
|
||||
end try
|
||||
|
||||
try
|
||||
do shell script "mkdir -p \"" & (gdPath & newResourcesPath) & "\""
|
||||
do shell script "mv \"" & (binPath & resourcesPath) & "\"* \"" & (gdPath & newResourcesPath) & "\""
|
||||
do shell script "INSTALLER_USER=$(stat -f '%Su' $HOME) && chown -R $INSTALLER_USER \"" & (gdPath & newGeodePath) & "\""
|
||||
on error
|
||||
ExitWithMessage ("Moving resources failed: " & (gdPath & newResourcesPath))
|
||||
end try
|
||||
|
||||
try
|
||||
do shell script "sudo xattr -dr com.apple.quarantine \"" & gdPath & "\""
|
||||
on error
|
||||
|
||||
end try
|
||||
|
||||
else if installerAnswer is "Uninstall Geode" then
|
||||
|
||||
try
|
||||
do shell script "rm \"" & (frameworkPath & geodePath) & "\""
|
||||
do shell script "rm \"" & (frameworkPath & bootstrapperPath) & "\""
|
||||
do shell script "rm \"" & (frameworkPath & fmodPath) & "\""
|
||||
on error
|
||||
ExitWithMessage ("Removing libraries failed: " & frameworkPath)
|
||||
end try
|
||||
|
||||
try
|
||||
do shell script "mv \"" & (frameworkPath & fmodOriginalPath) & "\" \"" & (frameworkPath & fmodPath) & "\""
|
||||
on error
|
||||
ExitWithMessage ("Restoring original fmod failed: " & (frameworkPath & fmodPath))
|
||||
end try
|
||||
|
||||
try
|
||||
do shell script "rm -r \"" & (gdPath & newGeodePath) & "\""
|
||||
on error
|
||||
ExitWithMessage ("Removing geode folder failed: " & (gdPath & newGeodePath))
|
||||
end try
|
||||
|
||||
end if
|
||||
|
||||
try
|
||||
do shell script "sudo rm -rf \"" & binPath & "\""
|
||||
on error
|
||||
|
||||
end try
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
pkgbuild --root "$1" --identifier com.geode-sdk.geode --scripts "installer/mac/Scripts" --install-location "/tmp/geode-install" $2
|
Binary file not shown.
Before ![]() (image error) Size: 201 KiB |
Binary file not shown.
Before (image error) Size: 4.2 KiB |
Binary file not shown.
Before (image error) Size: 4.2 KiB |
|
@ -1,16 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT Czech
|
||||
|
||||
!pragma warning disable 6030
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "Tento průvodce vás provede instalací $(^NameDA).$\r$\n$\r$\nPřed spuštěním instalace se přesvědčte, že hra Geometry Dash není spuštěna.$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Tento průvodce vás provede odinstalací $(^NameDA).$\r$\n$\r$\nPřed spuštěním odinstalace se přesvědčte, že hra Geometry Dash není spuštěna.$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nV této cestě se nenachází Geometry Dash!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nVaše verze Geometry Dash je moc stará pro tuto verzi Geode!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "V této cestě jsou již nainstalovány jiné mody!$\r$\nGeode bude nainstalován místo nich. (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "V této cestě se nenachází Geode!"
|
|
@ -1,26 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT English
|
||||
|
||||
!pragma warning disable 6030 ; overwriting default MUI strings on purpose
|
||||
; to translate these strings:
|
||||
; 1. copy them from C:\Program Files (x86)\NSIS\Contrib\Language Files\*.nsh
|
||||
; 2. copy the second line from uninstall text to install text and make it say "installation" instead of "uninstallation"
|
||||
; 3. replace $(^NameDA) in second line with Geometry Dash
|
||||
; 4. do not translate "(the dll trademark)", since that is replaced with the actual dll text
|
||||
; Note: please, format translation files the *exact same* way they are formatted in
|
||||
; other translations. Remove this entire comment block,
|
||||
; do not translate the "installer" and "uninstaller" comments and
|
||||
; do not remove the '!pragma ...' and '!insertmacro ...' lines at the top.
|
||||
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "Setup will guide you through the installation of $(^NameDA).$\r$\n$\r$\nBefore starting the installation, make sure Geometry Dash is not running.$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Setup will guide you through the uninstallation of $(^NameDA).$\r$\n$\r$\nBefore starting the uninstallation, make sure Geometry Dash is not running.$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nThis path does not have Geometry Dash installed!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nYour version of Geometry Dash is too old for this version of Geode!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "This path has other mods installed!$\r$\nThey will be overwritten by Geode. (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "This path does not have Geode installed!"
|
|
@ -1,16 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT Finnish
|
||||
|
||||
!pragma warning disable 6030
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "Saat tarvittavia ohjeita sitä mukaa kuin $(^NameDA) -ohjelman asennus edistyy.$\r$\n$\r$\nVarmistathan ennen asentamista, että Geometry Dash ei ole käynnissä.$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Saat tarvittavia ohjeita sitä mukaa kuin $(^NameDA) -ohjelman poisto edistyy.$\r$\n$\r$\nVarmistathan ennen poistamista, että Geometry Dash ei ole käynnissä.$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nValitussa kansiossa ei ole Geometry Dash -peliä asennettuna."
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nGeometry Dash -pelisi on vanhentunut, eikä ole yhteensopiva tämän Geode-version kanssa!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "Valitussa kansiossa on muita modeja asennettuna!$\r$\nGeode tulee poistamaan ne. (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "Valitussa kansiossa ei ole Geode -modilataajaa asennettuna."
|
|
@ -1,16 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT French
|
||||
|
||||
!pragma warning disable 6030
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "Le programme d'installation vous guidera tout au long de l'installation de $(^NameDA).$\r$\n$\r$\nAvant de démarrer l'installation, assurez-vous que Geometry Dash n'est pas en cours d'exécution.$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Le programme d'installation vous guidera tout au long de la désinstallation de $(^NameDA).$\r$\n$\r$\nAvant de démarrer la désinstallation, assurez-vous que Geometry Dash n'est pas en cours d'exécution.$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nGeometry Dash n'est pas installé sur ce chemin !"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nVotre version de Geometry Dash est trop ancienne pour cette version de Geode !"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "Ce chemin a d'autres mods installés !$\r$\nIls seront écrasés par Geode. (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "Geode n'est pas installé sur ce chemin !"
|
|
@ -1,16 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT German
|
||||
|
||||
!pragma warning disable 6030
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "Dieses Setup führt Sie durch die Installation von $(^NameDA).$\r$\n$\r$\nBevor Sie die Installation starten, stellen Sie sicher, dass Geometry Dash nicht rennt.$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Dieses Setup führt Sie durch die Deinstallation von $(^NameDA).$\r$\n$\r$\nBevor Sie die Deinstallation starten, stellen Sie sicher, dass Geometry Dash nicht rennt.$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nIn diesem Pfad ist Geometry Dash nicht installiert!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nIhre Geometry Dash Version ist zu alt für diese Version von Geode!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "In diesem Pfad sind andere Mods installiert!$\r$\nSie werden von Geode überschrieben. (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "In diesem Pfad ist Geode nicht installiert!"
|
|
@ -1,16 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT Greek
|
||||
|
||||
!pragma warning disable 6030
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "Το setup θα σας καθοδηγήσει για την εγκατάσταση του $(^NameDA).$\r$\n$\r$\nΠρίν ξεκινήσετε την εγκατάσταση, βεβαιωθήτε ότι το Geometry Dash δεν τρέχει.$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Το setup θα σας καθοδηγήσει για την απεγκατάσταση του $(^NameDA).$\r$\n$\r$\nΠριν την απεγκατάσταση, βεβαιωθήτε ότι το Geometry Dash δεν τρέχει.$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nΑυτό το path δεν έχει το Geometry Dash εγκατεστημένο!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nΗ έκδοση του Geometry Dash σας είναι πολύ παλιά για αυτή την έκδοση του Geode!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "Αυτή η διαδρομή έχει ήδη εγκατεστημένα άλλα mods!$\r$\nΘα αντικατασταθούν από το Geode. (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "Αυτό το path δεν έχει το Geode εγκατεστημένο!"
|
|
@ -1,16 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT Japanese
|
||||
|
||||
!pragma warning disable 6030
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "このセットアップは$(^NameDA)のインストールを案内します。$\r$\n$\r$\nインストールを開始する前に、Geometry Dashが実行されていないことを確認してください。$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "このセットアップは$(^NameDA)のアンインストールを案内します。$\r$\n$\r$\nアンインストールを開始する前に、Geometry Dashが実行されていないことを確認してください。$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nこのパスにはGeometry Dashがインストールされていません!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nGeometry DashのバージョンはこのGeodeのバージョンには古すぎます!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "このパスには他のモッドがインストールされています!$\r$\nそれらはGeodeによって上書きされます。(the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "このパスにはGeodeがインストールされていません!"
|
|
@ -1,16 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT Korean
|
||||
|
||||
!pragma warning disable 6030
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "이 프로그램은 $(^NameDA)의 설치를 진행해줄 것입니다.$\r$\n$\r$\n설치를 시작하기 전에, Geometry Dash가 켜져있지 않은지 확인해주세요.$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "이 프로그램은 $(^NameDA)의 삭제를 진행해줄 것입니다.$\r$\n$\r$\n삭제를 시작하기 전에, Geometry Dash가 켜져있지 않은지 확인해주세요.$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\n이 경로에는 Geometry Dash가 설치되어 있지 않습니다."
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nYour version of Geometry Dash is too old for this version of Geode!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "이 경로에는 다른 모드가 설치되어 있습니다!$\r$\nGeode에 의해 덮어쓰게 될 것입니다. (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "이 경로에는 Geode가 설치되어 있지 않습니다!"
|
|
@ -1,16 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT Polish
|
||||
|
||||
!pragma warning disable 6030
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "Instalator przeprowadzi Cię przez instalację $(^NameDA).$\r$\n$\r$\nPrzed rozpoczęciem instalacji, upewnij się, że Geometry Dash nie jest uruchomione.$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Instalator przeprowadzi Cię przez dezinstalację $(^NameDA).$\r$\n$\r$\nPrzed rozpoczęciem dezinstalacji, upewnij się, że Geometry Dash nie jest uruchomione.$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nGeometry Dash nie jest zainstalowane w tym folderze!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nTwoja wersja Geometry Dash jest zbyt stara dla tej wersji Geode!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "W tym folderze zainstalowane są inne modyfikacje!$\r$\nZostaną one zastąpione przez Geode. (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "Geode nie jest zainstalowane w tym folderze!"
|
|
@ -1,16 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT PortugueseBR
|
||||
|
||||
!pragma warning disable 6030
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "O instalador guiará você através da instalação de $(^NameDA).$\r$\n$\r$\nAntes de iniciar a instalação tenha certeza de que o Geometry Dash não está aberto.$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "O instalador guiará você através da desinstalação de $(^NameDA).$\r$\n$\r$\nAntes de iniciar a desinstalação tenha certeza de que o Geometry Dash não está aberto.$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nEsse caminho não tem Geometry Dash instalado!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nSua versão do Geometry Dash é muito antiga para essa versão do Geode!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "Esse caminho já tem outros mods instalados!$\r$\nEles serão substituídos pelo Geode. (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "Esse caminho não tem Geode instalado!"
|
|
@ -1,16 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT Portuguese
|
||||
|
||||
!pragma warning disable 6030
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "O instalador irá guiá-lo através da instalação de $(^NameDA).$\r$\n$\r$\nAntes de iniciar a instalação, certifique-se de que o Geometry Dash não está aberto.$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "O instalador irá guiá-lo através da desinstalação de $(^NameDA).$\r$\n$\r$\nAntes de iniciar a desinstalação, certifique-se de que o Geometry Dash não está aberto.$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nEsse caminho não tem o Geometry Dash instalado!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nA sua versão do Geometry Dash é demasiado antiga para esta versão do Geode!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "Esse caminho já tem outros mods instalados!$\r$\nEles serão substituídos pelo Geode. (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "Esse caminho não tem o Geode instalado!"
|
|
@ -1,16 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT Russian
|
||||
|
||||
!pragma warning disable 6030
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "Эта программа установит $(^NameDA) на ваш компьютер.$\r$\n$\r$\nПеред началом установки убедитесь, что Geometry Dash не запущен.$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Эта программа удалит $(^NameDA) из вашего компьютера.$\r$\n$\r$\nПеред началом удаления убедитесь, что Geometry Dash не запущен.$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nПо этому пути не установлен Geometry Dash!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nВаша версия Geometry Dash слишком старая для этой версии Geode!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "По этому пути уже установлены другие моды!$\r$\nОни будут перезаписаны Geode. (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "По этому пути не установлен Geode!"
|
|
@ -1,16 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT SimpChinese
|
||||
|
||||
!pragma warning disable 6030
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "Setup会帮您安装$(^NameDA)。$\r$\n$\r$\n安装Geode之前,请确认Geometry Dash已经关闭。$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Setup会帮您卸载$(^NameDA)。$\r$\n$\r$\n卸载Geode之前,请确认Geometry Dash已经关闭。$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nGeometry Dash不在这文件夹,请再试一遍!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\n您的Geometry Dash版本太旧了,不适合Geode的版本!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "这文件夹已经安装了不同的游戏修改器加载器!$\r$\nGeode会改写那些游戏修改器加载器。 (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "Geode不在这文件夹,请再试一遍!"
|
|
@ -1,16 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT Spanish
|
||||
|
||||
!pragma warning disable 6030
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "Este asistente te guiará durante la instalación de $(^NameDA) en tu ordenador.$\r$\n$\r$\nAntes de comenzar la instalación, asegúrate de que Geometry Dash no esté en ejecución.$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Este asistente te guiará durante la desinstalación de $(^NameDA).$\r$\n$\r$\nAntes de comenzar la desinstalación, asegúrate de que Geometry Dash no esté en ejecución.$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\n¡Geometry Dash no está instalado en esta ruta!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nTu versión de Geometry Dash es muy vieja para esta versión de Geode!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "Esta ruta ya tiene otros mods instalados!$\r$\nEstos serán sobreescritos por Geode. (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "¡Geode no está instalado en esta ruta!"
|
|
@ -1,16 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT SpanishInternational
|
||||
|
||||
!pragma warning disable 6030
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "Este asistente le guiará durante la instalación de Geode en su computadora.$\r$\n$\r$\nAntes de iniciar la instalación, asegúrese de que Geometry Dash no se está ejecutando$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Este asistente le guiará durante la desinstalación de Geode.$\r$\n$\r$\nAntes de iniciar la desinstalación, asegúrese de que Geometry Dash no se está ejecutando.$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\n¡Geometry Dash no está instalado en esta ruta!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\n¡Su versión de Geometry Dash es demasiado antigua para esta versión de Geode!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "¡Esta ruta ya tiene otros mods instalados!$\r$\nVan a ser sobreescritos por Geode. (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "¡Geode no está instalado en esta ruta!"
|
|
@ -1,16 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT Swedish
|
||||
|
||||
!pragma warning disable 6030
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "Denna guide tar dig igenom installationen av $(^NameDA).$\r$\n$\r$\nInnan du startar installationen, försäkra dig om att Geometry Dash inte körs.$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Denna guide tar dig igenom avinstallationen av $(^NameDA).$\r$\n$\r$\nInnan du startar avinstallationen, försäkra dig om att Geometry Dash inte körs.$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nDen valda mappen innehåller ingen installation av Geometry Dash."
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nDin version av Geometry Dash är för gammal för denna versionen av Geode!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "Den valda versionen av Geometry Dash har andra mod redan installerad!$\r$\nDom ska skrivs över av Geode. (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "Den valda mappen innehåller ingen installation av Geode."
|
|
@ -1,16 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT TradChinese
|
||||
|
||||
!pragma warning disable 6030
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "Setup會幫您安裝$(^NameDA)。$\r$\n$\r$\n安裝Geode之前,請確認Geometry Dash已經關閉。$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Setup會幫您卸載$(^NameDA)。$\r$\n$\r$\n卸載Geode之前,請確認Geometry Dash已經關閉。$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nGeometry Dash不在這文件夾,請再試一遍!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\n您的Geometry Dash版本太舊了,不適合Geode的版本!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "這文件夾已經安裝了不同的遊戲修改器加載器!$\r$\nGeode會改寫那些遊戲修改器加載器。 (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "Geode不在這文件夾,請再試一遍!"
|
|
@ -1,16 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT Turkish
|
||||
|
||||
!pragma warning disable 6030
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "Bu sihirbaz size $(^NameDA) kurulumu boyunca rehberlik edecektir.$\r$\n$\r$\nKurulumu başlatmadan önce Geometry Dash'i kapatmanızı öneririz.$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Bu sihirbaz size $(^NameDA) programının kadırılımı boyunca rehberlik edecektir.$\r$\n$\r$\nKaldırım işlemeni başlatmadan önce Geometry Dash'i kapatmanızı öneririz.$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nBu dizin yolunda Geometry Dash yüklü değildir!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nGeometry Dash versiyonunuz bu Geode versiyonu için çok eskidir!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "Bu dizin yolunda başka modlar yüklüdür!$\r$\nGeode bunların üzerine yazılacaktır. (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "Bu dizin yolunda Geode yüklü değildir!"
|
|
@ -1,16 +0,0 @@
|
|||
!insertmacro LANGFILE_EXT Ukrainian
|
||||
|
||||
!pragma warning disable 6030
|
||||
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "Ця програма допоможе вам встановити $(^NameDA).$\r$\n$\r$\nПеред початком встановлення переконайтеся, що Geometry Dash не запущено.$\r$\n$\r$\n$_CLICK"
|
||||
${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Ця програма допоможе вам видалити $(^NameDA).$\r$\n$\r$\nПеред початком видалення переконайтеся, що Geometry Dash не запущено.$\r$\n$\r$\n$_CLICK"
|
||||
!pragma warning default 6030
|
||||
|
||||
; installer
|
||||
|
||||
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nУ цій теці не встановлено Geometry Dash!"
|
||||
${LangFileString} GEODE_TEXT_GD_OLD "$\r$\n$\r$\nВаша версія Geometry Dash занадто стара для цієї версії Geode!"
|
||||
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "Ця тека вже містить інші моди!$\r$\nВони будуть замінені Geode. (the dll trademark)"
|
||||
|
||||
; uninstaller
|
||||
|
||||
${LangFileString} GEODE_UNTEXT_GEODE_MISSING "У цій теці не встановлено Geode!"
|
|
@ -1,4 +0,0 @@
|
|||
if(Test-path VC_redist.x64.exe -PathType leaf) {
|
||||
Return
|
||||
}
|
||||
Invoke-WebRequest -useb https://aka.ms/vs/17/release/vc_redist.x64.exe -outfile VC_redist.x64.exe
|
|
@ -1,584 +0,0 @@
|
|||
; includes
|
||||
!include MUI2.nsh
|
||||
!include nsDialogs.nsh
|
||||
!include WinMessages.nsh
|
||||
|
||||
; settings
|
||||
Name "Geode"
|
||||
OutFile "geode-installer-win.exe"
|
||||
Unicode true
|
||||
InstallDir "$PROGRAMFILES32\Steam\steamapps\common\Geometry Dash\" ; set default path to the most common one
|
||||
XPStyle on
|
||||
RequestExecutionLevel user
|
||||
ManifestSupportedOS Win7
|
||||
SetCompressor /SOLID lzma
|
||||
SetCompressorDictSize 64
|
||||
SetDatablockOptimize ON
|
||||
|
||||
; ui settings
|
||||
!define MUI_ABORTWARNING
|
||||
!define MUI_LANGDLL_ALLLANGUAGES
|
||||
!define MUI_FINISHPAGE_NOAUTOCLOSE
|
||||
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
|
||||
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
|
||||
!define MUI_ICON Graphics\logo_inst.ico
|
||||
!define MUI_UNICON Graphics\logo_uninst.ico
|
||||
!define MUI_WELCOMEFINISHPAGE_BITMAP Graphics\banner.bmp
|
||||
!define MUI_UNWELCOMEFINISHPAGE_BITMAP Graphics\banner.bmp
|
||||
|
||||
; pages
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_LICENSE "..\..\LICENSE.txt"
|
||||
!define MUI_COMPONENTSPAGE_NODESC
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_SHOW DirectoryPageShow
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
!insertmacro MUI_UNPAGE_WELCOME
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
!insertmacro MUI_UNPAGE_FINISH
|
||||
|
||||
; languages
|
||||
!macro GEODE_LANGUAGE NSFID
|
||||
!insertmacro MUI_LANGUAGE ${NSFID}
|
||||
!insertmacro LANGFILE_INCLUDE "Language Files\${NSFID}Extra.nsh"
|
||||
!macroend
|
||||
|
||||
; TODO: add the commented out languages (other available languages are listed here: https://nsis.sourceforge.io/Examples/Modern%20UI/MultiLanguage.nsi)
|
||||
!insertmacro GEODE_LANGUAGE "English"
|
||||
!insertmacro GEODE_LANGUAGE "French"
|
||||
!insertmacro GEODE_LANGUAGE "German"
|
||||
!insertmacro GEODE_LANGUAGE "Spanish"
|
||||
!insertmacro GEODE_LANGUAGE "SpanishInternational"
|
||||
!insertmacro GEODE_LANGUAGE "Swedish"
|
||||
!insertmacro GEODE_LANGUAGE "Greek"
|
||||
!insertmacro GEODE_LANGUAGE "Finnish"
|
||||
!insertmacro GEODE_LANGUAGE "Polish"
|
||||
!insertmacro GEODE_LANGUAGE "Russian"
|
||||
!insertmacro GEODE_LANGUAGE "PortugueseBR"
|
||||
!insertmacro GEODE_LANGUAGE "Portuguese"
|
||||
!insertmacro GEODE_LANGUAGE "Ukrainian"
|
||||
!insertmacro GEODE_LANGUAGE "Czech"
|
||||
!insertmacro GEODE_LANGUAGE "Turkish"
|
||||
!insertmacro GEODE_LANGUAGE "Japanese"
|
||||
!insertmacro GEODE_LANGUAGE "SimpChinese"
|
||||
!insertmacro GEODE_LANGUAGE "TradChinese"
|
||||
!insertmacro GEODE_LANGUAGE "Korean"
|
||||
|
||||
!insertmacro MUI_RESERVEFILE_LANGDLL
|
||||
|
||||
; random shit
|
||||
; https://nsis.sourceforge.io/StrReplace
|
||||
!define StrRep "!insertmacro StrRep"
|
||||
!macro StrRep output string old new
|
||||
Push `${string}`
|
||||
Push `${old}`
|
||||
Push `${new}`
|
||||
!ifdef __UNINSTALL__
|
||||
Call un.StrRep
|
||||
!else
|
||||
Call StrRep
|
||||
!endif
|
||||
Pop ${output}
|
||||
!macroend
|
||||
!macro Func_StrRep un
|
||||
Function ${un}StrRep
|
||||
Exch $R2 ;new
|
||||
Exch 1
|
||||
Exch $R1 ;old
|
||||
Exch 2
|
||||
Exch $R0 ;string
|
||||
Push $R3
|
||||
Push $R4
|
||||
Push $R5
|
||||
Push $R6
|
||||
Push $R7
|
||||
Push $R8
|
||||
Push $R9
|
||||
|
||||
StrCpy $R3 0
|
||||
StrLen $R4 $R1
|
||||
StrLen $R6 $R0
|
||||
StrLen $R9 $R2
|
||||
loop:
|
||||
StrCpy $R5 $R0 $R4 $R3
|
||||
StrCmp $R5 $R1 found
|
||||
StrCmp $R3 $R6 done
|
||||
IntOp $R3 $R3 + 1 ;move offset by 1 to check the next character
|
||||
Goto loop
|
||||
found:
|
||||
StrCpy $R5 $R0 $R3
|
||||
IntOp $R8 $R3 + $R4
|
||||
StrCpy $R7 $R0 "" $R8
|
||||
StrCpy $R0 $R5$R2$R7
|
||||
StrLen $R6 $R0
|
||||
IntOp $R3 $R3 + $R9 ;move offset by length of the replacement string
|
||||
Goto loop
|
||||
done:
|
||||
|
||||
Pop $R9
|
||||
Pop $R8
|
||||
Pop $R7
|
||||
Pop $R6
|
||||
Pop $R5
|
||||
Pop $R4
|
||||
Pop $R3
|
||||
Push $R0
|
||||
Push $R1
|
||||
Pop $R0
|
||||
Pop $R1
|
||||
Pop $R0
|
||||
Pop $R2
|
||||
Exch $R1
|
||||
FunctionEnd
|
||||
!macroend
|
||||
!insertmacro Func_StrRep ""
|
||||
;!insertmacro Func_StrRep "un."
|
||||
|
||||
; https://nsis.sourceforge.io/Remove_leading_and_trailing_whitespaces_from_a_string
|
||||
Function Trim
|
||||
Exch $R1 ; Original string
|
||||
Push $R2
|
||||
Loop:
|
||||
StrCpy $R2 "$R1" 1
|
||||
StrCmp "$R2" " " TrimLeft
|
||||
StrCmp "$R2" "$\r" TrimLeft
|
||||
StrCmp "$R2" "$\n" TrimLeft
|
||||
StrCmp "$R2" "$\t" TrimLeft
|
||||
Goto Loop2
|
||||
TrimLeft:
|
||||
StrCpy $R1 "$R1" "" 1
|
||||
Goto Loop
|
||||
Loop2:
|
||||
StrCpy $R2 "$R1" 1 -1
|
||||
StrCmp "$R2" " " TrimRight
|
||||
StrCmp "$R2" "$\r" TrimRight
|
||||
StrCmp "$R2" "$\n" TrimRight
|
||||
StrCmp "$R2" "$\t" TrimRight
|
||||
Goto Done
|
||||
TrimRight:
|
||||
StrCpy $R1 "$R1" -1
|
||||
Goto Loop2
|
||||
Done:
|
||||
Pop $R2
|
||||
Exch $R1
|
||||
FunctionEnd
|
||||
!define Trim "!insertmacro Trim"
|
||||
!macro Trim ResultVar String
|
||||
Push "${String}"
|
||||
Call Trim
|
||||
Pop "${ResultVar}"
|
||||
!macroend
|
||||
|
||||
; https://nsis.sourceforge.io/Split_strings
|
||||
!macro GET_STRING_TOKEN INPUT PART
|
||||
Push $R0
|
||||
Push $R1
|
||||
Push $R2
|
||||
StrCpy $R0 -1
|
||||
IntOp $R1 ${PART} * 2
|
||||
IntOp $R1 $R1 - 1
|
||||
findStart_loop_${PART}:
|
||||
IntOp $R0 $R0 + 1
|
||||
StrCpy $R2 ${INPUT} 1 $R0
|
||||
StrCmp $R2 "" error_${PART}
|
||||
StrCmp $R2 '"' 0 findStart_loop_${PART}
|
||||
IntOp $R1 $R1 - 1
|
||||
IntCmp $R1 0 0 0 findStart_loop_${PART}
|
||||
IntOp $R1 $R0 + 1
|
||||
findEnd_loop_${PART}:
|
||||
IntOp $R0 $R0 + 1
|
||||
StrCpy $R2 ${INPUT} 1 $R0
|
||||
StrCmp $R2 "" error_${PART}
|
||||
StrCmp $R2 '"' 0 findEnd_loop_${PART}
|
||||
IntOp $R0 $R0 - $R1
|
||||
StrCpy $R0 ${INPUT} $R0 $R1
|
||||
Goto done_${PART}
|
||||
error_${PART}:
|
||||
StrCpy $R0 error
|
||||
done_${PART}:
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
Exch $R0
|
||||
!macroend
|
||||
|
||||
; https://nsis.sourceforge.io/StrStr
|
||||
Function un.StrStr
|
||||
Exch $R0
|
||||
Exch
|
||||
Exch $R1
|
||||
Push $R2
|
||||
Push $R3
|
||||
Push $R4
|
||||
Push $R5
|
||||
|
||||
StrLen $R2 $R0
|
||||
StrLen $R3 $R1
|
||||
|
||||
StrCpy $R4 0
|
||||
|
||||
loop:
|
||||
StrCpy $R5 $R1 $R2 $R4
|
||||
StrCmp $R5 $R0 done
|
||||
IntCmp $R4 $R3 done 0 done
|
||||
IntOp $R4 $R4 + 1
|
||||
Goto loop
|
||||
done:
|
||||
StrCpy $R0 $R1 `` $R4
|
||||
|
||||
Pop $R5
|
||||
Pop $R4
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
Exch $R0
|
||||
FunctionEnd
|
||||
|
||||
; https://nsis.sourceforge.io/Get_command_line_parameters
|
||||
Function un.GetParameters
|
||||
Push $R0
|
||||
Push $R1
|
||||
Push $R2
|
||||
Push $R3
|
||||
|
||||
StrCpy $R2 1
|
||||
StrLen $R3 $CMDLINE
|
||||
|
||||
StrCpy $R0 $CMDLINE $R2
|
||||
StrCmp $R0 '"' 0 +3
|
||||
StrCpy $R1 '"'
|
||||
Goto loop
|
||||
StrCpy $R1 " "
|
||||
|
||||
loop:
|
||||
IntOp $R2 $R2 + 1
|
||||
StrCpy $R0 $CMDLINE 1 $R2
|
||||
StrCmp $R0 $R1 get
|
||||
StrCmp $R2 $R3 get
|
||||
Goto loop
|
||||
|
||||
get:
|
||||
IntOp $R2 $R2 + 1
|
||||
StrCpy $R0 $CMDLINE 1 $R2
|
||||
StrCmp $R0 " " get
|
||||
StrCpy $R0 $CMDLINE "" $R2
|
||||
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
Exch $R0
|
||||
FunctionEnd
|
||||
|
||||
; https://nsis.sourceforge.io/Get_command_line_parameter_by_name
|
||||
Function un.GetParameterValue
|
||||
Exch $R0
|
||||
Exch
|
||||
Exch $R1
|
||||
|
||||
Push $R2
|
||||
Push $R3
|
||||
Push $R4
|
||||
Push $R5
|
||||
|
||||
Strlen $R2 $R1+2
|
||||
|
||||
Call un.GetParameters
|
||||
Pop $R3
|
||||
|
||||
StrCpy $R5 '"'
|
||||
Push $R3
|
||||
Push '"/$R1='
|
||||
Call un.StrStr
|
||||
Pop $R4
|
||||
StrCpy $R4 $R4 "" 1
|
||||
StrCmp $R4 "" "" next
|
||||
|
||||
StrCpy $R5 ' '
|
||||
Push $R3
|
||||
Push '/$R1='
|
||||
Call un.StrStr
|
||||
Pop $R4
|
||||
|
||||
next:
|
||||
StrCmp $R4 "" check_for_switch
|
||||
StrCpy $R0 $R4 "" $R2
|
||||
Push $R0
|
||||
Push $R5
|
||||
Call un.StrStr
|
||||
Pop $R4
|
||||
StrCmp $R4 "" done
|
||||
StrLen $R4 $R4
|
||||
StrCpy $R0 $R0 -$R4
|
||||
goto done
|
||||
|
||||
check_for_switch:
|
||||
Push $R3
|
||||
Push '/$R1'
|
||||
Call un.StrStr
|
||||
Pop $R4
|
||||
StrCmp $R4 "" done
|
||||
StrCpy $R0 ""
|
||||
|
||||
done:
|
||||
Pop $R5
|
||||
Pop $R4
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
Exch $R0
|
||||
FunctionEnd
|
||||
|
||||
; actual code
|
||||
|
||||
!define BINDIR ..\..\bin\nightly
|
||||
|
||||
; installer
|
||||
|
||||
Var geode.DirectoryPage.ErrorText
|
||||
|
||||
Var GamePath
|
||||
Function FindGamePath
|
||||
Push $0
|
||||
Push $1
|
||||
Push $2
|
||||
Push $3
|
||||
Push $4
|
||||
|
||||
# get steam path
|
||||
ReadRegStr $0 HKCU "Software\Valve\Steam" "SteamPath"
|
||||
IfErrors gamePathError
|
||||
${StrRep} $0 $0 "/" "\"
|
||||
|
||||
# read library folders
|
||||
FileOpen $1 "$0\steamapps\libraryfolders.vdf" r
|
||||
IfErrors gamePathError
|
||||
|
||||
vdfReadLine:
|
||||
ClearErrors
|
||||
FileRead $1 $2
|
||||
IfErrors vdfDone
|
||||
${Trim} $2 $2
|
||||
!insertmacro GET_STRING_TOKEN $2 1
|
||||
Pop $4
|
||||
StrCmp $4 "path" 0 vdfCheckAppId
|
||||
!insertmacro GET_STRING_TOKEN $2 2
|
||||
Pop $3 # save current library path into $3
|
||||
vdfCheckAppId:
|
||||
SetErrors
|
||||
StrCmp $4 "322170" 0 vdfReadLine
|
||||
ClearErrors # gd found in current library
|
||||
vdfDone:
|
||||
IfErrors gamePathError
|
||||
|
||||
FileClose $1
|
||||
IfErrors gamePathError
|
||||
|
||||
${StrRep} $0 $3 "\\" "\"
|
||||
StrCpy $GamePath "$0\steamapps\common\Geometry Dash"
|
||||
|
||||
# make sure game path is correct
|
||||
IfFileExists "$GamePath\*.exe" +2 0
|
||||
gamePathError:
|
||||
SetErrors
|
||||
Pop $4
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $1
|
||||
Pop $0
|
||||
FunctionEnd
|
||||
|
||||
Function DirectoryPageShow
|
||||
System::Call 'USER32::CreateWindowEx(i${__NSD_Label_EXSTYLE}, t"${__NSD_Label_CLASS}", t"", i${__NSD_Label_STYLE}, i0, i70, i400, i40, p$mui.DirectoryPage, p0, p0, p0)p.s'
|
||||
Pop $geode.DirectoryPage.ErrorText
|
||||
ShowWindow $geode.DirectoryPage.ErrorText 0
|
||||
SendMessage $mui.DirectoryPage ${WM_GETFONT} 0 0 $0
|
||||
SendMessage $geode.DirectoryPage.ErrorText ${WM_SETFONT} $0 1
|
||||
SetCtlColors $geode.DirectoryPage.ErrorText ff0000 transparent
|
||||
; place the label at the top
|
||||
System::Call 'USER32::SetWindowPos(p$geode.DirectoryPage.ErrorText, p0, i0, i0, i0, i0, i3)i'
|
||||
Pop $0
|
||||
FunctionEnd
|
||||
|
||||
Function .onVerifyInstDir
|
||||
LockWindow on
|
||||
|
||||
; check if there's any exe and libcocos2d.dll (GeometryDash.exe won't work because of GDPSes)
|
||||
IfFileExists $INSTDIR\*.exe 0 noGameNoLife
|
||||
IfFileExists $INSTDIR\libcocos2d.dll 0 noGameNoLife
|
||||
|
||||
; check if we're on 64-bit gd (checks for some of the DLLs introduced in 2.206)
|
||||
IfFileExists $INSTDIR\libpng16.dll 0 versionIssueImo
|
||||
IfFileExists $INSTDIR\pthreadVC3.dll 0 versionIssueImo
|
||||
IfFileExists $INSTDIR\libcrypto-3-x64.dll 0 versionIssueImo
|
||||
|
||||
; check if geode is already installed
|
||||
IfFileExists $INSTDIR\Geode.dll valid
|
||||
|
||||
; check mod loaders/mod menus
|
||||
IfFileExists $INSTDIR\hackpro.dll other_hackpro
|
||||
IfFileExists $INSTDIR\XInput1_4.dll other_xinput
|
||||
|
||||
; all checks passed
|
||||
valid:
|
||||
ShowWindow $geode.DirectoryPage.ErrorText 0
|
||||
LockWindow off
|
||||
Return
|
||||
|
||||
noGameNoLife:
|
||||
SendMessage $geode.DirectoryPage.ErrorText ${WM_SETTEXT} "" "STR:$(GEODE_TEXT_GD_MISSING)"
|
||||
Goto error
|
||||
versionIssueImo:
|
||||
SendMessage $geode.DirectoryPage.ErrorText ${WM_SETTEXT} "" "STR:$(GEODE_TEXT_GD_OLD)"
|
||||
Goto error
|
||||
other_hackpro:
|
||||
StrCpy $0 "hackpro.dll"
|
||||
Goto other
|
||||
other_xinput:
|
||||
StrCpy $0 "XInput1_4.dll"
|
||||
Goto other
|
||||
other:
|
||||
${StrRep} $0 $(GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED) "the dll trademark" $0
|
||||
SendMessage $geode.DirectoryPage.ErrorText ${WM_SETTEXT} "" "STR:$0"
|
||||
SetCtlColors $geode.DirectoryPage.ErrorText e25402 transparent
|
||||
LockWindow off
|
||||
Return
|
||||
|
||||
error:
|
||||
ShowWindow $geode.DirectoryPage.ErrorText 1
|
||||
SetCtlColors $geode.DirectoryPage.ErrorText ff0000 transparent
|
||||
LockWindow off
|
||||
Abort
|
||||
Return
|
||||
FunctionEnd
|
||||
|
||||
SectionGroup "Geode"
|
||||
Section "Loader" LOADER_SECTION
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
File ${BINDIR}\Geode.dll
|
||||
File ${BINDIR}\Geode.pdb
|
||||
File ${BINDIR}\GeodeUpdater.exe
|
||||
File ${BINDIR}\XInput1_4.dll
|
||||
|
||||
RMdir /r $INSTDIR\geode\update
|
||||
RMdir /r $INSTDIR\geode\index
|
||||
Delete "$INSTDIR\xinput9_1_0.dll"
|
||||
Delete "$INSTDIR\xinput9_1_0.lib"
|
||||
Delete "$INSTDIR\xinput9_1_0.pdb"
|
||||
|
||||
Delete "$INSTDIR\hackpro.dll"
|
||||
|
||||
Delete "$INSTDIR\msvcp140.dll"
|
||||
Delete "$INSTDIR\msvcp140d.dll"
|
||||
Delete "$INSTDIR\vcruntime140.dll"
|
||||
Delete "$INSTDIR\vcruntime140d.dll"
|
||||
|
||||
WriteUninstaller "GeodeUninstaller.exe"
|
||||
SectionEnd
|
||||
|
||||
Section "Resources"
|
||||
CreateDirectory $INSTDIR\geode\resources\geode.loader
|
||||
SetOutPath $INSTDIR\geode\resources\geode.loader
|
||||
File /r ${BINDIR}\resources\*
|
||||
SectionEnd
|
||||
SectionGroupEnd
|
||||
|
||||
; download vc redist in compile-time
|
||||
!execute "pwsh -nol -noni -nop dl-vcr.ps1"
|
||||
Section "Visual Studio Runtime"
|
||||
SetOutPath $INSTDIR
|
||||
File VC_redist.x64.exe
|
||||
ExecWait "$INSTDIR\VC_redist.x64.exe /install /quiet /norestart"
|
||||
Delete "$INSTDIR\VC_redist.x64.exe"
|
||||
SectionEnd
|
||||
|
||||
Section "steam_appid.txt"
|
||||
SetOutPath $INSTDIR
|
||||
FileOpen $0 "$INSTDIR\steam_appid.txt" w
|
||||
FileWrite $0 "322170"
|
||||
FileClose $0
|
||||
SectionEnd
|
||||
|
||||
Function .onInit
|
||||
!insertmacro MUI_LANGDLL_DISPLAY
|
||||
|
||||
IntOp $0 ${SF_SELECTED} | ${SF_RO}
|
||||
SectionSetFlags ${LOADER_SECTION} $0
|
||||
|
||||
Call FindGamePath
|
||||
IfErrors 0 +3
|
||||
StrCpy $GamePath ""
|
||||
Return
|
||||
StrCpy $INSTDIR "$GamePath\"
|
||||
FunctionEnd
|
||||
|
||||
; uninstaller
|
||||
|
||||
Function un.onInit
|
||||
!insertmacro MUI_UNGETLANGUAGE
|
||||
|
||||
; verify uninst dir
|
||||
|
||||
; check if there's any exe and libcocos2d.dll (GeometryDash.exe won't work because of GDPSes)
|
||||
IfFileExists $INSTDIR\*.exe 0 invalid
|
||||
IfFileExists $INSTDIR\libcocos2d.dll 0 invalid
|
||||
|
||||
; check if xinput and geode exist
|
||||
IfFileExists $INSTDIR\XInput1_4.dll 0 invalid
|
||||
IfFileExists $INSTDIR\Geode.dll 0 invalid
|
||||
Return
|
||||
|
||||
invalid:
|
||||
MessageBox MB_ICONSTOP|MB_OK $(GEODE_UNTEXT_GEODE_MISSING)
|
||||
Abort
|
||||
FunctionEnd
|
||||
Section "Uninstall"
|
||||
DeleteRegKey /ifempty HKCU "Software\Geode"
|
||||
Delete $INSTDIR\GeodeUninstaller.exe
|
||||
Delete $INSTDIR\Geode.dll
|
||||
Delete $INSTDIR\Geode.pdb
|
||||
Delete $INSTDIR\Geode.lib
|
||||
Delete $INSTDIR\GeodeUpdater.exe
|
||||
Delete $INSTDIR\XInput1_4.dll
|
||||
|
||||
# default value of DATA is an empty string
|
||||
# if DATA is empty, keep user data
|
||||
# otherwise, delete the entire geode and DATA\geode\mods dirs
|
||||
# the reason we're deleting DATA\geode\mods instead of just passing
|
||||
# that dir directly to DATA is so that in case someone (either accidentally or maliciously)
|
||||
# passes the wrong directory, the uninstaller doesn't just blindly clear it
|
||||
# it will also check for the presence of CCGameManager.dat and CCLocalLevels.dat in DATA
|
||||
|
||||
Push "DATA"
|
||||
Push ""
|
||||
Call un.GetParameterValue
|
||||
Pop $0
|
||||
StrCmp $0 "" keep_data remove_data
|
||||
|
||||
keep_data:
|
||||
# keep configs, mods, logs and crash logs
|
||||
RMdir /r $INSTDIR\geode\index
|
||||
RMdir /r $INSTDIR\geode\resources
|
||||
RMdir /r $INSTDIR\geode\temp
|
||||
RMdir /r $INSTDIR\geode\unzipped
|
||||
RMdir /r $INSTDIR\geode\update
|
||||
Return
|
||||
|
||||
remove_data:
|
||||
RMdir /r $INSTDIR\geode
|
||||
IfFileExists $0\CCGameManager.dat 0 invalid
|
||||
IfFileExists $0\CCLocalLevels.dat 0 invalid
|
||||
RMdir /r $0\geode\mods ; delete DATA\geode\mods
|
||||
RMdir $0\geode ; then delete DATA\geode non-recursively, assuming mods is the only directory in DATA\geode
|
||||
Return
|
||||
|
||||
invalid:
|
||||
# this message doesnt rly need translatable as
|
||||
# its only supposed to be used internally by geode itself
|
||||
MessageBox MB_ICONSTOP|MB_OK "The path passed to DATA is not a valid Geometry Dash data folder!"
|
||||
Abort
|
||||
|
||||
SectionEnd
|
|
@ -1,384 +0,0 @@
|
|||
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
|
||||
cmake_policy(SET CMP0097 NEW)
|
||||
|
||||
project(geode-loader VERSION ${GEODE_VERSION} LANGUAGES C CXX)
|
||||
if (GEODE_VERSION_TAG_TYPE)
|
||||
if (GEODE_VERSION_TAG_NUMBER)
|
||||
set(PROJECT_VERSION_TAG_CONSTR "geode::VersionTag(geode::VersionTag::${GEODE_VERSION_TAG_TYPE}, ${GEODE_VERSION_TAG_NUMBER})")
|
||||
else()
|
||||
set(PROJECT_VERSION_TAG_CONSTR "geode::VersionTag::${GEODE_VERSION_TAG_TYPE}")
|
||||
endif()
|
||||
else()
|
||||
set(PROJECT_VERSION_TAG_CONSTR "std::nullopt")
|
||||
endif()
|
||||
|
||||
if (GEODE_VERSION_TAG)
|
||||
set(PROJECT_VERSION_SUFFIX "-${GEODE_VERSION_TAG}" CACHE INTERNAL "" )
|
||||
else()
|
||||
set(PROJECT_VERSION_SUFFIX "" CACHE INTERNAL "" )
|
||||
endif()
|
||||
|
||||
# I think CMake is trying to link zlib from the host system?
|
||||
# This prevents it from doing that.
|
||||
if (WIN32 AND CMAKE_CROSSCOMPILING)
|
||||
set(MZ_FORCE_FETCH_LIBS ON)
|
||||
endif()
|
||||
|
||||
# https://stackoverflow.com/a/63924044/9124836
|
||||
# https://stackoverflow.com/a/72396471
|
||||
execute_process(
|
||||
COMMAND git describe --always --dirty
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GEODE_COMMIT_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
|
||||
if (NOT GEODE_COMMIT_HASH)
|
||||
set(GEODE_COMMIT_HASH "(?)")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND git describe --always --dirty
|
||||
WORKING_DIRECTORY ${GEODE_BINDINGS_REPO_PATH}
|
||||
OUTPUT_VARIABLE GEODE_BINDINGS_COMMIT_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
|
||||
if (NOT GEODE_BINDINGS_COMMIT_HASH)
|
||||
set(GEODE_BINDINGS_COMMIT_HASH "(?)")
|
||||
endif()
|
||||
|
||||
# Package info file for internal representation
|
||||
set(GEODE_RESOURCES_PATH ${CMAKE_CURRENT_SOURCE_DIR}/resources)
|
||||
configure_file(resources/mod.json.in ${CMAKE_CURRENT_SOURCE_DIR}/resources/mod.json)
|
||||
file(READ resources/mod.json LOADER_MOD_JSON)
|
||||
configure_file(${GEODE_ROOT_PATH}/VERSION ${GEODE_RESOURCES_PATH}/version COPYONLY)
|
||||
configure_file(${GEODE_RESOURCES_PATH}/about.md.in ${GEODE_RESOURCES_PATH}/about.md NEWLINE_STYLE LF)
|
||||
configure_file(${GEODE_ROOT_PATH}/CHANGELOG.md ${GEODE_RESOURCES_PATH}/changelog.md NEWLINE_STYLE LF)
|
||||
configure_file(${GEODE_RESOURCES_PATH}/support.md.in ${GEODE_RESOURCES_PATH}/support.md NEWLINE_STYLE LF)
|
||||
configure_file(src/internal/about.cpp.in ${CMAKE_CURRENT_SOURCE_DIR}/src/internal/about.cpp)
|
||||
|
||||
# Source files
|
||||
file(GLOB SOURCES CONFIGURE_DEPENDS
|
||||
src/cocos2d-ext/*.cpp
|
||||
src/cocos2d-ext/zip/*.cpp
|
||||
src/core/*.cpp
|
||||
src/hooks/*.cpp
|
||||
src/ids/*.cpp
|
||||
src/internal/*.cpp
|
||||
src/server/*.cpp
|
||||
src/loader/*.cpp
|
||||
src/load.cpp
|
||||
src/utils/*.cpp
|
||||
src/ui/*.cpp
|
||||
src/ui/nodes/*.cpp
|
||||
src/ui/other/*.cpp
|
||||
src/ui/mods/*.cpp
|
||||
src/ui/mods/list/*.cpp
|
||||
src/ui/mods/popups/*.cpp
|
||||
src/ui/mods/events/*.cpp
|
||||
src/ui/mods/sources/*.cpp
|
||||
src/ui/mods/settings/*.cpp
|
||||
src/ui/mods/test/*.cpp
|
||||
src/ui/*.cpp
|
||||
src/c++stl/*.cpp
|
||||
hash/hash.cpp
|
||||
)
|
||||
|
||||
# Obj-c sources
|
||||
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS" OR IOS)
|
||||
file(GLOB OBJC_SOURCES CONFIGURE_DEPENDS
|
||||
src/platform/ios/*.mm
|
||||
src/load.mm
|
||||
src/hooks/AddExtraKeys.mm
|
||||
)
|
||||
else()
|
||||
file(GLOB OBJC_SOURCES CONFIGURE_DEPENDS
|
||||
src/platform/mac/*.mm
|
||||
src/load.mm
|
||||
src/hooks/AddExtraKeys.mm
|
||||
)
|
||||
endif()
|
||||
set_source_files_properties(${OBJC_SOURCES} PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
|
||||
|
||||
if (WIN32)
|
||||
# This allows you to compile in debug mode
|
||||
add_compile_definitions(_HAS_ITERATOR_DEBUGGING=0)
|
||||
add_definitions(-D_HAS_ITERATOR_DEBUGGING=0)
|
||||
endif()
|
||||
|
||||
|
||||
# Add platform sources
|
||||
if (WIN32)
|
||||
|
||||
file(GLOB WIN_SOURCES CONFIGURE_DEPENDS
|
||||
src/platform/windows/*.cpp
|
||||
)
|
||||
list(APPEND SOURCES ${WIN_SOURCES})
|
||||
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS" OR IOS)
|
||||
file(GLOB IOS_SOURCES CONFIGURE_DEPENDS
|
||||
src/platform/ios/*.cpp
|
||||
src/platform/mac/Cocos2d.cpp # identical on ios, so we just use the mac one
|
||||
)
|
||||
list(APPEND SOURCES ${IOS_SOURCES})
|
||||
list(APPEND SOURCES ${OBJC_SOURCES})
|
||||
|
||||
elseif(APPLE)
|
||||
file(GLOB MAC_SOURCES CONFIGURE_DEPENDS
|
||||
src/platform/mac/*.cpp
|
||||
)
|
||||
list(APPEND SOURCES ${MAC_SOURCES})
|
||||
list(APPEND SOURCES ${OBJC_SOURCES})
|
||||
|
||||
elseif(ANDROID)
|
||||
|
||||
file(GLOB ANDROID_SOURCES CONFIGURE_DEPENDS
|
||||
src/platform/android/*.cpp
|
||||
)
|
||||
list(APPEND SOURCES ${ANDROID_SOURCES})
|
||||
|
||||
endif()
|
||||
|
||||
# Embed version info in binary
|
||||
if (WIN32)
|
||||
configure_file(src/platform/windows/info.rc.in info.rc)
|
||||
set(SOURCES ${SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/info.rc)
|
||||
endif()
|
||||
|
||||
|
||||
if (ANDROID AND GEODE_USE_BREAKPAD)
|
||||
CPMAddPackage("gh:qimiko/breakpad#169df6a")
|
||||
endif()
|
||||
|
||||
add_library(${PROJECT_NAME} SHARED ${SOURCES})
|
||||
|
||||
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)
|
||||
|
||||
file(MAKE_DIRECTORY "${GEODE_BIN_PATH}/nightly")
|
||||
|
||||
# Prevent SDK from activating a loader build
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
PREFIX ""
|
||||
OUTPUT_NAME ${GEODE_OUTPUT_NAME}
|
||||
# i'm going to say a slur that not a single soul has uttered in the last 200 years
|
||||
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${GEODE_BIN_PATH}/nightly"
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${GEODE_BIN_PATH}/nightly"
|
||||
ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${GEODE_BIN_PATH}/nightly"
|
||||
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${GEODE_BIN_PATH}/nightly"
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${GEODE_BIN_PATH}/nightly"
|
||||
ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${GEODE_BIN_PATH}/nightly"
|
||||
LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL "${GEODE_BIN_PATH}/nightly"
|
||||
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${GEODE_BIN_PATH}/nightly"
|
||||
ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL "${GEODE_BIN_PATH}/nightly"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${GEODE_BIN_PATH}/nightly"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${GEODE_BIN_PATH}/nightly"
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${GEODE_BIN_PATH}/nightly"
|
||||
)
|
||||
|
||||
if (GEODE_NO_UNDEFINED_VIRTUALS)
|
||||
target_compile_definitions(${PROJECT_NAME} PUBLIC GEODE_NO_UNDEFINED_VIRTUALS)
|
||||
endif()
|
||||
|
||||
# CA Bundle
|
||||
CPMAddPackage(
|
||||
GITHUB_REPOSITORY geode-sdk/net_libs
|
||||
GIT_TAG 1f5ffb3
|
||||
# CPM is bugged and will not allow an empty string.
|
||||
# https://github.com/cpm-cmake/CPM.cmake/issues/467
|
||||
# https://github.com/cpm-cmake/CPM.cmake/issues/461
|
||||
GIT_SUBMODULES "nghttp3"
|
||||
GIT_SUBMODULES_RECURSE OFF
|
||||
)
|
||||
target_link_libraries(${PROJECT_NAME} ca-bundle)
|
||||
|
||||
# Package resources for UI
|
||||
package_geode_resources_now(
|
||||
${PROJECT_NAME}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/resources
|
||||
${GEODE_BIN_PATH}/nightly/resources
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/internal/resources.hpp
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
# I don't care a single bit where to put this
|
||||
file(COPY ${GEODE_LOADER_PATH}/include/link/macos/libfmod.dylib DESTINATION ${GEODE_BIN_PATH}/nightly)
|
||||
endif()
|
||||
|
||||
if (ANDROID)
|
||||
# needed to define some opengl functions
|
||||
target_link_libraries(${PROJECT_NAME} EGL)
|
||||
|
||||
if (GEODE_USE_BREAKPAD)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE -DGEODE_USE_BREAKPAD)
|
||||
target_link_libraries(${PROJECT_NAME} Breakpad)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||
src/
|
||||
src/loader/
|
||||
src/internal/
|
||||
src/platform/
|
||||
src/gui/
|
||||
hash/
|
||||
./
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
# For profiling
|
||||
target_compile_options(${PROJECT_NAME} PUBLIC "-ftime-trace")
|
||||
# target_link_options(${PROJECT_NAME} PRIVATE "-Wl,-e,_dynamicInit")
|
||||
#set_property(TARGET ${PROJECT_NAME} PROPERTY RULE_LAUNCH_COMPILE "${CMAKE_COMMAND} -E time")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} PUBLIC GEODE_EXPORTING MAT_JSON_EXPORTING)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||
GEODE_EXPOSE_SECRET_INTERNALS_IN_HEADERS_DO_NOT_DEFINE_PLEASE
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
)
|
||||
|
||||
# set GEODE_MOD_ID for loader itself
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE GEODE_MOD_ID="geode.loader")
|
||||
|
||||
# These are only needed for building source :-)
|
||||
if (NOT GEODE_BUILDING_DOCS)
|
||||
# Markdown support
|
||||
CPMAddPackage("gh:mity/md4c#release-0.5.2")
|
||||
|
||||
# Zip support (needed for in-memory streams, which zlib's minizip doesn't support)
|
||||
set(MZ_LZMA OFF CACHE INTERNAL "")
|
||||
set(MZ_ZSTD OFF CACHE INTERNAL "")
|
||||
set(MZ_BZIP2 OFF CACHE INTERNAL "")
|
||||
set(MZ_OPENSSL OFF CACHE INTERNAL "")
|
||||
set(MZ_LIBBSD OFF CACHE INTERNAL "")
|
||||
set(MZ_FETCH_LIBS ON CACHE INTERNAL "" FORCE)
|
||||
set(MZ_FORCE_FETCH_LIBS ${WIN32} CACHE INTERNAL "")
|
||||
set(SKIP_INSTALL_ALL ON CACHE INTERNAL "")
|
||||
CPMAddPackage("gh:geode-sdk/minizip-ng#43d9254")
|
||||
if (WIN32)
|
||||
set_target_properties(zlib PROPERTIES SUFFIX "1.dll")
|
||||
endif()
|
||||
|
||||
# Silence warnings from dependencies
|
||||
include(CheckCXXCompilerFlag)
|
||||
check_cxx_compiler_flag(-Wno-everything SUPPORTS_W_NO_EVERYTHING)
|
||||
if (SUPPORTS_W_NO_EVERYTHING)
|
||||
if (TARGET md4c)
|
||||
target_compile_options(md4c PRIVATE -Wno-everything)
|
||||
endif()
|
||||
if (TARGET zlib)
|
||||
target_compile_options(zlib PRIVATE -Wno-everything)
|
||||
endif()
|
||||
if (TARGET zlibstatic)
|
||||
get_property(zlibstatic_ALIASED TARGET zlibstatic PROPERTY ALIASED_TARGET)
|
||||
if ("${zlibstatic_ALIASED}" STREQUAL "")
|
||||
target_compile_options(zlibstatic PRIVATE -Wno-everything)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Cool date library
|
||||
CPMAddPackage("gh:HowardHinnant/date#1ead671")
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${md4c_SOURCE_DIR}/src)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} md4c minizip date)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} TulipHook geode-sdk mat-json-impl)
|
||||
|
||||
# Required by curl for macos
|
||||
if (APPLE)
|
||||
target_link_libraries(${PROJECT_NAME} z)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
# Disable outputting .exp file
|
||||
include(CheckLinkerFlag)
|
||||
check_linker_flag(CXX /NOEXP SUPPORTS_NOEXP)
|
||||
if (SUPPORTS_NOEXP)
|
||||
target_link_options(${PROJECT_NAME} PRIVATE /NOEXP)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
# allows forward compat on windows
|
||||
if (MSVC)
|
||||
target_link_options(${PROJECT_NAME} PRIVATE /DELAYLOAD:libcocos2d.dll /DELAYLOAD:libExtensions.dll)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
target_link_options(${PROJECT_NAME} PRIVATE "-Wl,/delayload:libcocos2d.dll" "-Wl,/delayload:libExtensions.dll")
|
||||
else()
|
||||
message(FATAL_ERROR "Unable to set DELAYLOAD! This is essential for Geode forward compatibility to work.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Use precompiled headers for faster builds
|
||||
if (NOT GEODE_DISABLE_PRECOMPILED_HEADERS)
|
||||
target_precompile_headers(${PROJECT_NAME} PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Geode.hpp"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Create launcher
|
||||
if (APPLE)
|
||||
|
||||
if("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS" OR IOS)
|
||||
# Used for File Picker API
|
||||
find_library(UNIFORM_TYPE_IDENTIFIERS_FRAMEWORK UniformTypeIdentifiers)
|
||||
target_link_libraries(${PROJECT_NAME} ${UNIFORM_TYPE_IDENTIFIERS_FRAMEWORK})
|
||||
else()
|
||||
set_target_properties(geode-loader PROPERTIES
|
||||
SYSTEM_NAME MacOS
|
||||
OSX_DEPLOYMENT_TARGET 10.15
|
||||
APPLE_SILICON_PROCESSOR x86_64
|
||||
)
|
||||
|
||||
# geodebootstrapper is unused on ios
|
||||
add_subdirectory(launcher/mac)
|
||||
set(LAUNCHER_TARGET GeodeBootstrapper)
|
||||
endif()
|
||||
elseif (WIN32)
|
||||
add_subdirectory(launcher/windows)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} dbghelp winmm)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} PUBLIC ISOLATION_AWARE_ENABLED=1)
|
||||
|
||||
if (MSVC)
|
||||
# disable warnings about CCNode::setID
|
||||
target_link_options(${PROJECT_NAME} PUBLIC /ignore:4217)
|
||||
endif()
|
||||
|
||||
set(LAUNCHER_TARGET ProxyLoader Updater)
|
||||
endif()
|
||||
|
||||
add_subdirectory(test)
|
||||
|
||||
# Add install target on CLI >= 2.10.0 (which adds `geode profile path`)
|
||||
if (NOT GEODE_BUILDING_DOCS)
|
||||
# nest this because when building docs GEODE_CLI_VERSION is not defined
|
||||
if (${GEODE_CLI_VERSION} VERSION_GREATER_EQUAL "2.10.0")
|
||||
execute_process(
|
||||
COMMAND ${GEODE_CLI} profile path -d
|
||||
OUTPUT_VARIABLE GEODE_PROFILE_GD_PATH
|
||||
RESULT_VARIABLE GEODE_PROFILE_GD_PATH_RESULT
|
||||
)
|
||||
if (${GEODE_PROFILE_GD_PATH_RESULT} EQUAL 0)
|
||||
string(STRIP ${GEODE_PROFILE_GD_PATH} GEODE_PROFILE_GD_PATH)
|
||||
install(
|
||||
TARGETS geode-loader ${LAUNCHER_TARGET}
|
||||
RUNTIME
|
||||
DESTINATION "${GEODE_PROFILE_GD_PATH}"
|
||||
)
|
||||
file(GLOB RESOURCE_FILES ${GEODE_BIN_PATH}/nightly/resources/*.*)
|
||||
install(
|
||||
FILES ${RESOURCE_FILES}
|
||||
DESTINATION "${GEODE_PROFILE_GD_PATH}/geode/resources/geode.loader"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
|
@ -1,44 +0,0 @@
|
|||
# Loader
|
||||
|
||||
Repository for the Geode Mod Loader
|
||||
|
||||
## Documentation
|
||||
|
||||
See [docs](https://geode-sdk.github.io/docs/)
|
||||
|
||||
## Building
|
||||
|
||||
### Prerequisites:
|
||||
|
||||
* [CMake](https://cmake.org/download/) (minimum v3.13.4)
|
||||
* A supported C++ compiler ([clang](https://releases.llvm.org/)/[MSVC](https://visualstudio.microsoft.com/downloads/))
|
||||
* [Geode CLI](https://github.com/geode-sdk/cli) (Highly Recommended)
|
||||
* [git](https://git-scm.com/downloads) (Highly Recommended)
|
||||
|
||||
### Quick instructions (for thigh-high programmers)
|
||||
|
||||
1. `git clone`
|
||||
|
||||
2. `mkdir build; cd build; cmake .. -T host=x64 -A win32`
|
||||
|
||||
3. `cmake --build`
|
||||
|
||||
### Recommended way (for newbies)
|
||||
|
||||
1. Install [VS Code](https://code.visualstudio.com/)
|
||||
|
||||
2. Install the [C/C++](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) and [CMake Tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) extensions for VS Code
|
||||
|
||||
3. Open up the command line and navigate to any directory where you'd like to build the loader
|
||||
|
||||
4. `git clone https://github.com/geode-sdk/loader --recurse-submodules`
|
||||
|
||||
5. Open up the directory in VS Code
|
||||
|
||||
6. Press F1 to open the Command Palette and run `CMake: Configure` (make sure to select an x86 generator)
|
||||
|
||||
7. Open up the Command Palette again and run `CMake: Select Variant` (select either `Release` or `RelWithDebInfo`)
|
||||
|
||||
8. Click `Build` on the bottom status bar or run `CMake: Build`
|
||||
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
#include "hash.hpp"
|
||||
|
||||
// shh, its fine :-)
|
||||
#include "sha3.cpp"
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <ciso646>
|
||||
#include "picosha2.h"
|
||||
#include <vector>
|
||||
|
||||
template <class Func>
|
||||
void readBuffered(std::ifstream& stream, Func func) {
|
||||
constexpr size_t BUF_SIZE = 4096;
|
||||
stream.exceptions(std::ios_base::badbit);
|
||||
|
||||
std::vector<uint8_t> buffer(BUF_SIZE);
|
||||
while (true) {
|
||||
stream.read(reinterpret_cast<char*>(buffer.data()), BUF_SIZE);
|
||||
size_t amt = stream ? BUF_SIZE : stream.gcount();
|
||||
func(buffer.data(), amt);
|
||||
if (!stream) break;
|
||||
}
|
||||
}
|
||||
|
||||
std::string calculateSHA3_256(std::filesystem::path const& path) {
|
||||
std::ifstream file(path, std::ios::binary);
|
||||
SHA3 sha;
|
||||
readBuffered(file, [&](const void* data, size_t amt) {
|
||||
sha.add(data, amt);
|
||||
});
|
||||
return sha.getHash();
|
||||
}
|
||||
|
||||
std::string calculateSHA256(std::filesystem::path const& path) {
|
||||
std::vector<uint8_t> hash(picosha2::k_digest_size);
|
||||
std::ifstream file(path, std::ios::binary);
|
||||
picosha2::hash256(file, hash.begin(), hash.end());
|
||||
return picosha2::bytes_to_hex_string(hash.begin(), hash.end());
|
||||
}
|
||||
|
||||
std::string calculateSHA256Text(std::filesystem::path const& path) {
|
||||
// remove all newlines
|
||||
std::vector<uint8_t> hash(picosha2::k_digest_size);
|
||||
std::ifstream file(path);
|
||||
std::string text;
|
||||
std::string line;
|
||||
while (std::getline(file, line)) {
|
||||
text += line;
|
||||
}
|
||||
picosha2::hash256(text.begin(), text.end(), hash.begin(), hash.end());
|
||||
return picosha2::bytes_to_hex_string(hash.begin(), hash.end());
|
||||
}
|
||||
|
||||
std::string calculateHash(std::span<const uint8_t> data) {
|
||||
std::vector<uint8_t> hash(picosha2::k_digest_size);
|
||||
picosha2::hash256(data.begin(), data.end(), hash);
|
||||
return picosha2::bytes_to_hex_string(hash.begin(), hash.end());
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
#include <span>
|
||||
|
||||
std::string calculateSHA3_256(std::filesystem::path const& path);
|
||||
|
||||
std::string calculateSHA256(std::filesystem::path const& path);
|
||||
|
||||
std::string calculateSHA256Text(std::filesystem::path const& path);
|
||||
|
||||
/**
|
||||
* Calculates the SHA256 hash of the given data,
|
||||
* used for verifying mods.
|
||||
*/
|
||||
std::string calculateHash(std::span<const uint8_t> data);
|
|
@ -1,377 +0,0 @@
|
|||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 2017 okdshin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
#ifndef PICOSHA2_H
|
||||
#define PICOSHA2_H
|
||||
// picosha2:20140213
|
||||
|
||||
#ifndef PICOSHA2_BUFFER_SIZE_FOR_INPUT_ITERATOR
|
||||
#define PICOSHA2_BUFFER_SIZE_FOR_INPUT_ITERATOR \
|
||||
1048576 //=1024*1024: default is 1MB memory
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
namespace picosha2 {
|
||||
typedef unsigned long word_t;
|
||||
typedef unsigned char byte_t;
|
||||
|
||||
static const size_t k_digest_size = 32;
|
||||
|
||||
namespace detail {
|
||||
inline byte_t mask_8bit(byte_t x) { return x & 0xff; }
|
||||
|
||||
inline word_t mask_32bit(word_t x) { return x & 0xffffffff; }
|
||||
|
||||
const word_t add_constant[64] = {
|
||||
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,
|
||||
0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
|
||||
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,
|
||||
0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
||||
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
|
||||
0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
|
||||
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,
|
||||
0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
||||
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,
|
||||
0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
|
||||
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2};
|
||||
|
||||
const word_t initial_message_digest[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372,
|
||||
0xa54ff53a, 0x510e527f, 0x9b05688c,
|
||||
0x1f83d9ab, 0x5be0cd19};
|
||||
|
||||
inline word_t ch(word_t x, word_t y, word_t z) { return (x & y) ^ ((~x) & z); }
|
||||
|
||||
inline word_t maj(word_t x, word_t y, word_t z) {
|
||||
return (x & y) ^ (x & z) ^ (y & z);
|
||||
}
|
||||
|
||||
inline word_t rotr(word_t x, std::size_t n) {
|
||||
assert(n < 32);
|
||||
return mask_32bit((x >> n) | (x << (32 - n)));
|
||||
}
|
||||
|
||||
inline word_t bsig0(word_t x) { return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22); }
|
||||
|
||||
inline word_t bsig1(word_t x) { return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25); }
|
||||
|
||||
inline word_t shr(word_t x, std::size_t n) {
|
||||
assert(n < 32);
|
||||
return x >> n;
|
||||
}
|
||||
|
||||
inline word_t ssig0(word_t x) { return rotr(x, 7) ^ rotr(x, 18) ^ shr(x, 3); }
|
||||
|
||||
inline word_t ssig1(word_t x) { return rotr(x, 17) ^ rotr(x, 19) ^ shr(x, 10); }
|
||||
|
||||
template <typename RaIter1, typename RaIter2>
|
||||
void hash256_block(RaIter1 message_digest, RaIter2 first, RaIter2 last) {
|
||||
assert(first + 64 == last);
|
||||
static_cast<void>(last); // for avoiding unused-variable warning
|
||||
word_t w[64];
|
||||
std::fill(w, w + 64, word_t(0));
|
||||
for (std::size_t i = 0; i < 16; ++i) {
|
||||
w[i] = (static_cast<word_t>(mask_8bit(*(first + i * 4))) << 24) |
|
||||
(static_cast<word_t>(mask_8bit(*(first + i * 4 + 1))) << 16) |
|
||||
(static_cast<word_t>(mask_8bit(*(first + i * 4 + 2))) << 8) |
|
||||
(static_cast<word_t>(mask_8bit(*(first + i * 4 + 3))));
|
||||
}
|
||||
for (std::size_t i = 16; i < 64; ++i) {
|
||||
w[i] = mask_32bit(ssig1(w[i - 2]) + w[i - 7] + ssig0(w[i - 15]) +
|
||||
w[i - 16]);
|
||||
}
|
||||
|
||||
word_t a = *message_digest;
|
||||
word_t b = *(message_digest + 1);
|
||||
word_t c = *(message_digest + 2);
|
||||
word_t d = *(message_digest + 3);
|
||||
word_t e = *(message_digest + 4);
|
||||
word_t f = *(message_digest + 5);
|
||||
word_t g = *(message_digest + 6);
|
||||
word_t h = *(message_digest + 7);
|
||||
|
||||
for (std::size_t i = 0; i < 64; ++i) {
|
||||
word_t temp1 = h + bsig1(e) + ch(e, f, g) + add_constant[i] + w[i];
|
||||
word_t temp2 = bsig0(a) + maj(a, b, c);
|
||||
h = g;
|
||||
g = f;
|
||||
f = e;
|
||||
e = mask_32bit(d + temp1);
|
||||
d = c;
|
||||
c = b;
|
||||
b = a;
|
||||
a = mask_32bit(temp1 + temp2);
|
||||
}
|
||||
*message_digest += a;
|
||||
*(message_digest + 1) += b;
|
||||
*(message_digest + 2) += c;
|
||||
*(message_digest + 3) += d;
|
||||
*(message_digest + 4) += e;
|
||||
*(message_digest + 5) += f;
|
||||
*(message_digest + 6) += g;
|
||||
*(message_digest + 7) += h;
|
||||
for (std::size_t i = 0; i < 8; ++i) {
|
||||
*(message_digest + i) = mask_32bit(*(message_digest + i));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename InIter>
|
||||
void output_hex(InIter first, InIter last, std::ostream& os) {
|
||||
os.setf(std::ios::hex, std::ios::basefield);
|
||||
while (first != last) {
|
||||
os.width(2);
|
||||
os.fill('0');
|
||||
os << static_cast<unsigned int>(*first);
|
||||
++first;
|
||||
}
|
||||
os.setf(std::ios::dec, std::ios::basefield);
|
||||
}
|
||||
|
||||
template <typename InIter>
|
||||
void bytes_to_hex_string(InIter first, InIter last, std::string& hex_str) {
|
||||
std::ostringstream oss;
|
||||
output_hex(first, last, oss);
|
||||
hex_str.assign(oss.str());
|
||||
}
|
||||
|
||||
template <typename InContainer>
|
||||
void bytes_to_hex_string(const InContainer& bytes, std::string& hex_str) {
|
||||
bytes_to_hex_string(bytes.begin(), bytes.end(), hex_str);
|
||||
}
|
||||
|
||||
template <typename InIter>
|
||||
std::string bytes_to_hex_string(InIter first, InIter last) {
|
||||
std::string hex_str;
|
||||
bytes_to_hex_string(first, last, hex_str);
|
||||
return hex_str;
|
||||
}
|
||||
|
||||
template <typename InContainer>
|
||||
std::string bytes_to_hex_string(const InContainer& bytes) {
|
||||
std::string hex_str;
|
||||
bytes_to_hex_string(bytes, hex_str);
|
||||
return hex_str;
|
||||
}
|
||||
|
||||
class hash256_one_by_one {
|
||||
public:
|
||||
hash256_one_by_one() { init(); }
|
||||
|
||||
void init() {
|
||||
buffer_.clear();
|
||||
std::fill(data_length_digits_, data_length_digits_ + 4, word_t(0));
|
||||
std::copy(detail::initial_message_digest,
|
||||
detail::initial_message_digest + 8, h_);
|
||||
}
|
||||
|
||||
template <typename RaIter>
|
||||
void process(RaIter first, RaIter last) {
|
||||
add_to_data_length(static_cast<word_t>(std::distance(first, last)));
|
||||
std::copy(first, last, std::back_inserter(buffer_));
|
||||
std::size_t i = 0;
|
||||
for (; i + 64 <= buffer_.size(); i += 64) {
|
||||
detail::hash256_block(h_, buffer_.begin() + i,
|
||||
buffer_.begin() + i + 64);
|
||||
}
|
||||
buffer_.erase(buffer_.begin(), buffer_.begin() + i);
|
||||
}
|
||||
|
||||
void finish() {
|
||||
byte_t temp[64];
|
||||
std::fill(temp, temp + 64, byte_t(0));
|
||||
std::size_t remains = buffer_.size();
|
||||
std::copy(buffer_.begin(), buffer_.end(), temp);
|
||||
temp[remains] = 0x80;
|
||||
|
||||
if (remains > 55) {
|
||||
std::fill(temp + remains + 1, temp + 64, byte_t(0));
|
||||
detail::hash256_block(h_, temp, temp + 64);
|
||||
std::fill(temp, temp + 64 - 4, byte_t(0));
|
||||
} else {
|
||||
std::fill(temp + remains + 1, temp + 64 - 4, byte_t(0));
|
||||
}
|
||||
|
||||
write_data_bit_length(&(temp[56]));
|
||||
detail::hash256_block(h_, temp, temp + 64);
|
||||
}
|
||||
|
||||
template <typename OutIter>
|
||||
void get_hash_bytes(OutIter first, OutIter last) const {
|
||||
for (const word_t* iter = h_; iter != h_ + 8; ++iter) {
|
||||
for (std::size_t i = 0; i < 4 && first != last; ++i) {
|
||||
*(first++) = detail::mask_8bit(
|
||||
static_cast<byte_t>((*iter >> (24 - 8 * i))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void add_to_data_length(word_t n) {
|
||||
word_t carry = 0;
|
||||
data_length_digits_[0] += n;
|
||||
for (std::size_t i = 0; i < 4; ++i) {
|
||||
data_length_digits_[i] += carry;
|
||||
if (data_length_digits_[i] >= 65536u) {
|
||||
carry = data_length_digits_[i] >> 16;
|
||||
data_length_digits_[i] &= 65535u;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
void write_data_bit_length(byte_t* begin) {
|
||||
word_t data_bit_length_digits[4];
|
||||
std::copy(data_length_digits_, data_length_digits_ + 4,
|
||||
data_bit_length_digits);
|
||||
|
||||
// convert byte length to bit length (multiply 8 or shift 3 times left)
|
||||
word_t carry = 0;
|
||||
for (std::size_t i = 0; i < 4; ++i) {
|
||||
word_t before_val = data_bit_length_digits[i];
|
||||
data_bit_length_digits[i] <<= 3;
|
||||
data_bit_length_digits[i] |= carry;
|
||||
data_bit_length_digits[i] &= 65535u;
|
||||
carry = (before_val >> (16 - 3)) & 65535u;
|
||||
}
|
||||
|
||||
// write data_bit_length
|
||||
for (int i = 3; i >= 0; --i) {
|
||||
(*begin++) = static_cast<byte_t>(data_bit_length_digits[i] >> 8);
|
||||
(*begin++) = static_cast<byte_t>(data_bit_length_digits[i]);
|
||||
}
|
||||
}
|
||||
std::vector<byte_t> buffer_;
|
||||
word_t data_length_digits_[4]; // as 64bit integer (16bit x 4 integer)
|
||||
word_t h_[8];
|
||||
};
|
||||
|
||||
inline void get_hash_hex_string(const hash256_one_by_one& hasher,
|
||||
std::string& hex_str) {
|
||||
byte_t hash[k_digest_size];
|
||||
hasher.get_hash_bytes(hash, hash + k_digest_size);
|
||||
return bytes_to_hex_string(hash, hash + k_digest_size, hex_str);
|
||||
}
|
||||
|
||||
inline std::string get_hash_hex_string(const hash256_one_by_one& hasher) {
|
||||
std::string hex_str;
|
||||
get_hash_hex_string(hasher, hex_str);
|
||||
return hex_str;
|
||||
}
|
||||
|
||||
namespace impl {
|
||||
template <typename RaIter, typename OutIter>
|
||||
void hash256_impl(RaIter first, RaIter last, OutIter first2, OutIter last2, int,
|
||||
std::random_access_iterator_tag) {
|
||||
hash256_one_by_one hasher;
|
||||
// hasher.init();
|
||||
hasher.process(first, last);
|
||||
hasher.finish();
|
||||
hasher.get_hash_bytes(first2, last2);
|
||||
}
|
||||
|
||||
template <typename InputIter, typename OutIter>
|
||||
void hash256_impl(InputIter first, InputIter last, OutIter first2,
|
||||
OutIter last2, int buffer_size, std::input_iterator_tag) {
|
||||
std::vector<byte_t> buffer(buffer_size);
|
||||
hash256_one_by_one hasher;
|
||||
// hasher.init();
|
||||
while (first != last) {
|
||||
int size = buffer_size;
|
||||
for (int i = 0; i != buffer_size; ++i, ++first) {
|
||||
if (first == last) {
|
||||
size = i;
|
||||
break;
|
||||
}
|
||||
buffer[i] = *first;
|
||||
}
|
||||
hasher.process(buffer.begin(), buffer.begin() + size);
|
||||
}
|
||||
hasher.finish();
|
||||
hasher.get_hash_bytes(first2, last2);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename InIter, typename OutIter>
|
||||
void hash256(InIter first, InIter last, OutIter first2, OutIter last2,
|
||||
int buffer_size = PICOSHA2_BUFFER_SIZE_FOR_INPUT_ITERATOR) {
|
||||
picosha2::impl::hash256_impl(
|
||||
first, last, first2, last2, buffer_size,
|
||||
typename std::iterator_traits<InIter>::iterator_category());
|
||||
}
|
||||
|
||||
template <typename InIter, typename OutContainer>
|
||||
void hash256(InIter first, InIter last, OutContainer& dst) {
|
||||
hash256(first, last, dst.begin(), dst.end());
|
||||
}
|
||||
|
||||
template <typename InContainer, typename OutIter>
|
||||
void hash256(const InContainer& src, OutIter first, OutIter last) {
|
||||
hash256(src.begin(), src.end(), first, last);
|
||||
}
|
||||
|
||||
template <typename InContainer, typename OutContainer>
|
||||
void hash256(const InContainer& src, OutContainer& dst) {
|
||||
hash256(src.begin(), src.end(), dst.begin(), dst.end());
|
||||
}
|
||||
|
||||
template <typename InIter>
|
||||
void hash256_hex_string(InIter first, InIter last, std::string& hex_str) {
|
||||
byte_t hashed[k_digest_size];
|
||||
hash256(first, last, hashed, hashed + k_digest_size);
|
||||
std::ostringstream oss;
|
||||
output_hex(hashed, hashed + k_digest_size, oss);
|
||||
hex_str.assign(oss.str());
|
||||
}
|
||||
|
||||
template <typename InIter>
|
||||
std::string hash256_hex_string(InIter first, InIter last) {
|
||||
std::string hex_str;
|
||||
hash256_hex_string(first, last, hex_str);
|
||||
return hex_str;
|
||||
}
|
||||
|
||||
inline void hash256_hex_string(const std::string& src, std::string& hex_str) {
|
||||
hash256_hex_string(src.begin(), src.end(), hex_str);
|
||||
}
|
||||
|
||||
template <typename InContainer>
|
||||
void hash256_hex_string(const InContainer& src, std::string& hex_str) {
|
||||
hash256_hex_string(src.begin(), src.end(), hex_str);
|
||||
}
|
||||
|
||||
template <typename InContainer>
|
||||
std::string hash256_hex_string(const InContainer& src) {
|
||||
return hash256_hex_string(src.begin(), src.end());
|
||||
}
|
||||
template<typename OutIter>void hash256(std::ifstream& f, OutIter first, OutIter last){
|
||||
hash256(std::istreambuf_iterator<char>(f), std::istreambuf_iterator<char>(), first,last);
|
||||
|
||||
}
|
||||
}// namespace picosha2
|
||||
#endif // PICOSHA2_H
|
|
@ -1,299 +0,0 @@
|
|||
// //////////////////////////////////////////////////////////
|
||||
// sha3.cpp
|
||||
// Copyright (c) 2014,2015 Stephan Brumme. All rights reserved.
|
||||
// see http://create.stephan-brumme.com/disclaimer.html
|
||||
//
|
||||
|
||||
#include "sha3.h"
|
||||
|
||||
#include <bit>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
/// same as reset()
|
||||
SHA3::SHA3(Bits bits)
|
||||
: m_blockSize(200 - 2 * (bits / 8)),
|
||||
m_bits(bits)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
/// restart
|
||||
void SHA3::reset()
|
||||
{
|
||||
for (size_t i = 0; i < StateSize; i++)
|
||||
m_hash[i] = 0;
|
||||
|
||||
m_numBytes = 0;
|
||||
m_bufferSize = 0;
|
||||
}
|
||||
|
||||
|
||||
/// constants and local helper functions
|
||||
namespace
|
||||
{
|
||||
const unsigned int Rounds = 24;
|
||||
const uint64_t XorMasks[Rounds] =
|
||||
{
|
||||
0x0000000000000001ULL, 0x0000000000008082ULL, 0x800000000000808aULL,
|
||||
0x8000000080008000ULL, 0x000000000000808bULL, 0x0000000080000001ULL,
|
||||
0x8000000080008081ULL, 0x8000000000008009ULL, 0x000000000000008aULL,
|
||||
0x0000000000000088ULL, 0x0000000080008009ULL, 0x000000008000000aULL,
|
||||
0x000000008000808bULL, 0x800000000000008bULL, 0x8000000000008089ULL,
|
||||
0x8000000000008003ULL, 0x8000000000008002ULL, 0x8000000000000080ULL,
|
||||
0x000000000000800aULL, 0x800000008000000aULL, 0x8000000080008081ULL,
|
||||
0x8000000000008080ULL, 0x0000000080000001ULL, 0x8000000080008008ULL
|
||||
};
|
||||
|
||||
/// rotate left and wrap around to the right
|
||||
inline uint64_t rotateLeft(uint64_t x, uint8_t numBits)
|
||||
{
|
||||
return (x << numBits) | (x >> (64 - numBits));
|
||||
}
|
||||
|
||||
/// convert litte vs big endian
|
||||
inline uint64_t swap(uint64_t x)
|
||||
{
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
return __builtin_bswap64(x);
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
return _byteswap_uint64(x);
|
||||
#endif
|
||||
|
||||
return (x >> 56) |
|
||||
((x >> 40) & 0x000000000000FF00ULL) |
|
||||
((x >> 24) & 0x0000000000FF0000ULL) |
|
||||
((x >> 8) & 0x00000000FF000000ULL) |
|
||||
((x << 8) & 0x000000FF00000000ULL) |
|
||||
((x << 24) & 0x0000FF0000000000ULL) |
|
||||
((x << 40) & 0x00FF000000000000ULL) |
|
||||
(x << 56);
|
||||
}
|
||||
|
||||
inline uint64_t littleEndian(uint64_t x) {
|
||||
if constexpr (std::endian::native == std::endian::little) {
|
||||
return x;
|
||||
} else {
|
||||
return swap(x);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// return x % 5 for 0 <= x <= 9
|
||||
unsigned int mod5(unsigned int x)
|
||||
{
|
||||
if (x < 5)
|
||||
return x;
|
||||
|
||||
return x - 5;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// process a full block
|
||||
void SHA3::processBlock(const void* data)
|
||||
{
|
||||
const uint64_t* data64 = (const uint64_t*) data;
|
||||
// mix data into state
|
||||
for (unsigned int i = 0; i < m_blockSize / 8; i++)
|
||||
m_hash[i] ^= littleEndian(data64[i]);
|
||||
|
||||
// re-compute state
|
||||
for (unsigned int round = 0; round < Rounds; round++)
|
||||
{
|
||||
// Theta
|
||||
uint64_t coefficients[5];
|
||||
for (unsigned int i = 0; i < 5; i++)
|
||||
coefficients[i] = m_hash[i] ^ m_hash[i + 5] ^ m_hash[i + 10] ^ m_hash[i + 15] ^ m_hash[i + 20];
|
||||
|
||||
for (unsigned int i = 0; i < 5; i++)
|
||||
{
|
||||
uint64_t one = coefficients[mod5(i + 4)] ^ rotateLeft(coefficients[mod5(i + 1)], 1);
|
||||
m_hash[i ] ^= one;
|
||||
m_hash[i + 5] ^= one;
|
||||
m_hash[i + 10] ^= one;
|
||||
m_hash[i + 15] ^= one;
|
||||
m_hash[i + 20] ^= one;
|
||||
}
|
||||
|
||||
// temporary
|
||||
uint64_t one;
|
||||
|
||||
// Rho Pi
|
||||
uint64_t last = m_hash[1];
|
||||
one = m_hash[10]; m_hash[10] = rotateLeft(last, 1); last = one;
|
||||
one = m_hash[ 7]; m_hash[ 7] = rotateLeft(last, 3); last = one;
|
||||
one = m_hash[11]; m_hash[11] = rotateLeft(last, 6); last = one;
|
||||
one = m_hash[17]; m_hash[17] = rotateLeft(last, 10); last = one;
|
||||
one = m_hash[18]; m_hash[18] = rotateLeft(last, 15); last = one;
|
||||
one = m_hash[ 3]; m_hash[ 3] = rotateLeft(last, 21); last = one;
|
||||
one = m_hash[ 5]; m_hash[ 5] = rotateLeft(last, 28); last = one;
|
||||
one = m_hash[16]; m_hash[16] = rotateLeft(last, 36); last = one;
|
||||
one = m_hash[ 8]; m_hash[ 8] = rotateLeft(last, 45); last = one;
|
||||
one = m_hash[21]; m_hash[21] = rotateLeft(last, 55); last = one;
|
||||
one = m_hash[24]; m_hash[24] = rotateLeft(last, 2); last = one;
|
||||
one = m_hash[ 4]; m_hash[ 4] = rotateLeft(last, 14); last = one;
|
||||
one = m_hash[15]; m_hash[15] = rotateLeft(last, 27); last = one;
|
||||
one = m_hash[23]; m_hash[23] = rotateLeft(last, 41); last = one;
|
||||
one = m_hash[19]; m_hash[19] = rotateLeft(last, 56); last = one;
|
||||
one = m_hash[13]; m_hash[13] = rotateLeft(last, 8); last = one;
|
||||
one = m_hash[12]; m_hash[12] = rotateLeft(last, 25); last = one;
|
||||
one = m_hash[ 2]; m_hash[ 2] = rotateLeft(last, 43); last = one;
|
||||
one = m_hash[20]; m_hash[20] = rotateLeft(last, 62); last = one;
|
||||
one = m_hash[14]; m_hash[14] = rotateLeft(last, 18); last = one;
|
||||
one = m_hash[22]; m_hash[22] = rotateLeft(last, 39); last = one;
|
||||
one = m_hash[ 9]; m_hash[ 9] = rotateLeft(last, 61); last = one;
|
||||
one = m_hash[ 6]; m_hash[ 6] = rotateLeft(last, 20); last = one;
|
||||
m_hash[ 1] = rotateLeft(last, 44);
|
||||
|
||||
// Chi
|
||||
for (unsigned int j = 0; j < StateSize; j += 5)
|
||||
{
|
||||
// temporaries
|
||||
uint64_t one = m_hash[j];
|
||||
uint64_t two = m_hash[j + 1];
|
||||
|
||||
m_hash[j] ^= m_hash[j + 2] & ~two;
|
||||
m_hash[j + 1] ^= m_hash[j + 3] & ~m_hash[j + 2];
|
||||
m_hash[j + 2] ^= m_hash[j + 4] & ~m_hash[j + 3];
|
||||
m_hash[j + 3] ^= one & ~m_hash[j + 4];
|
||||
m_hash[j + 4] ^= two & ~one;
|
||||
}
|
||||
|
||||
// Iota
|
||||
m_hash[0] ^= XorMasks[round];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// add arbitrary number of bytes
|
||||
void SHA3::add(const void* data, size_t numBytes)
|
||||
{
|
||||
const uint8_t* current = (const uint8_t*) data;
|
||||
|
||||
// copy data to buffer
|
||||
if (m_bufferSize > 0)
|
||||
{
|
||||
while (numBytes > 0 && m_bufferSize < m_blockSize)
|
||||
{
|
||||
m_buffer[m_bufferSize++] = *current++;
|
||||
numBytes--;
|
||||
}
|
||||
}
|
||||
|
||||
// full buffer
|
||||
if (m_bufferSize == m_blockSize)
|
||||
{
|
||||
processBlock((void*)m_buffer);
|
||||
m_numBytes += m_blockSize;
|
||||
m_bufferSize = 0;
|
||||
}
|
||||
|
||||
// no more data ?
|
||||
if (numBytes == 0)
|
||||
return;
|
||||
|
||||
// process full blocks
|
||||
while (numBytes >= m_blockSize)
|
||||
{
|
||||
processBlock(current);
|
||||
current += m_blockSize;
|
||||
m_numBytes += m_blockSize;
|
||||
numBytes -= m_blockSize;
|
||||
}
|
||||
|
||||
// keep remaining bytes in buffer
|
||||
while (numBytes > 0)
|
||||
{
|
||||
m_buffer[m_bufferSize++] = *current++;
|
||||
numBytes--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// process everything left in the internal buffer
|
||||
void SHA3::processBuffer()
|
||||
{
|
||||
// add padding
|
||||
size_t offset = m_bufferSize;
|
||||
// add a "1" byte
|
||||
m_buffer[offset++] = 0x06;
|
||||
// fill with zeros
|
||||
while (offset < m_blockSize)
|
||||
m_buffer[offset++] = 0;
|
||||
|
||||
// and add a single set bit
|
||||
m_buffer[offset - 1] |= 0x80;
|
||||
|
||||
processBlock(m_buffer);
|
||||
}
|
||||
|
||||
|
||||
/// return latest hash as 16 hex characters
|
||||
std::string SHA3::getHash()
|
||||
{
|
||||
// save hash state
|
||||
uint64_t oldHash[StateSize];
|
||||
for (unsigned int i = 0; i < StateSize; i++)
|
||||
oldHash[i] = m_hash[i];
|
||||
|
||||
// process remaining bytes
|
||||
processBuffer();
|
||||
|
||||
// convert hash to string
|
||||
static const char dec2hex[16 + 1] = "0123456789abcdef";
|
||||
|
||||
// number of significant elements in hash (uint64_t)
|
||||
unsigned int hashLength = m_bits / 64;
|
||||
|
||||
std::string result;
|
||||
result.reserve(m_bits / 4);
|
||||
for (unsigned int i = 0; i < hashLength; i++)
|
||||
for (unsigned int j = 0; j < 8; j++) // 64 bits => 8 bytes
|
||||
{
|
||||
// convert a byte to hex
|
||||
unsigned char oneByte = (unsigned char) (m_hash[i] >> (8 * j));
|
||||
result += dec2hex[oneByte >> 4];
|
||||
result += dec2hex[oneByte & 15];
|
||||
}
|
||||
|
||||
// SHA3-224's last entry in m_hash provides only 32 bits instead of 64 bits
|
||||
unsigned int remainder = m_bits - hashLength * 64;
|
||||
unsigned int processed = 0;
|
||||
while (processed < remainder)
|
||||
{
|
||||
// convert a byte to hex
|
||||
unsigned char oneByte = (unsigned char) (m_hash[hashLength] >> processed);
|
||||
result += dec2hex[oneByte >> 4];
|
||||
result += dec2hex[oneByte & 15];
|
||||
|
||||
processed += 8;
|
||||
}
|
||||
|
||||
// restore state
|
||||
for (unsigned int i = 0; i < StateSize; i++)
|
||||
m_hash[i] = oldHash[i];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// compute SHA3 of a memory block
|
||||
std::string SHA3::operator()(const void* data, size_t numBytes)
|
||||
{
|
||||
reset();
|
||||
add(data, numBytes);
|
||||
return getHash();
|
||||
}
|
||||
|
||||
|
||||
/// compute SHA3 of a string, excluding final zero
|
||||
std::string SHA3::operator()(const std::string& text)
|
||||
{
|
||||
reset();
|
||||
add(text.c_str(), text.size());
|
||||
return getHash();
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
// //////////////////////////////////////////////////////////
|
||||
// sha3.h
|
||||
// Copyright (c) 2014,2015 Stephan Brumme. All rights reserved.
|
||||
// see http://create.stephan-brumme.com/disclaimer.html
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
//#include "hash.h"
|
||||
#include <string>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/// compute SHA3 hash
|
||||
/** Usage:
|
||||
SHA3 sha3;
|
||||
std::string myHash = sha3("Hello World"); // std::string
|
||||
std::string myHash2 = sha3("How are you", 11); // arbitrary data, 11 bytes
|
||||
|
||||
// or in a streaming fashion:
|
||||
|
||||
SHA3 sha3;
|
||||
while (more data available)
|
||||
sha3.add(pointer to fresh data, number of new bytes);
|
||||
std::string myHash3 = sha3.getHash();
|
||||
*/
|
||||
class SHA3 //: public Hash
|
||||
{
|
||||
public:
|
||||
/// algorithm variants
|
||||
enum Bits { Bits224 = 224, Bits256 = 256, Bits384 = 384, Bits512 = 512 };
|
||||
|
||||
/// same as reset()
|
||||
explicit SHA3(Bits bits = Bits256);
|
||||
|
||||
/// compute hash of a memory block
|
||||
std::string operator()(const void* data, size_t numBytes);
|
||||
/// compute hash of a string, excluding final zero
|
||||
std::string operator()(const std::string& text);
|
||||
|
||||
/// add arbitrary number of bytes
|
||||
void add(const void* data, size_t numBytes);
|
||||
|
||||
/// return latest hash as hex characters
|
||||
std::string getHash();
|
||||
|
||||
/// restart
|
||||
void reset();
|
||||
|
||||
private:
|
||||
/// process a full block
|
||||
void processBlock(const void* data);
|
||||
/// process everything left in the internal buffer
|
||||
void processBuffer();
|
||||
|
||||
/// 1600 bits, stored as 25x64 bit, BlockSize is no more than 1152 bits (Keccak224)
|
||||
enum { StateSize = 1600 / (8 * 8),
|
||||
MaxBlockSize = 200 - 2 * (224 / 8) };
|
||||
|
||||
/// hash
|
||||
uint64_t m_hash[StateSize];
|
||||
/// size of processed data in bytes
|
||||
uint64_t m_numBytes;
|
||||
/// block size (less or equal to MaxBlockSize)
|
||||
size_t m_blockSize;
|
||||
/// valid bytes in m_buffer
|
||||
size_t m_bufferSize;
|
||||
/// bytes not processed yet
|
||||
uint8_t m_buffer[MaxBlockSize];
|
||||
/// variant
|
||||
Bits m_bits;
|
||||
};
|
|
@ -1,23 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4251) // dll-interface
|
||||
#pragma warning(disable : 4099) // type first seen as 'class'
|
||||
#pragma warning(disable : 4584) // CCKeyboardDelegate included twice in UILayer
|
||||
#endif
|
||||
|
||||
#include <Geode/Enums.hpp>
|
||||
|
||||
#include <Geode/DefaultInclude.hpp>
|
||||
#include <Geode/utils/addresser.hpp>
|
||||
#include <cocos-ext.h>
|
||||
#include <cocos2d.h>
|
||||
#include <fmod.hpp>
|
||||
#include <stdint.h>
|
||||
#include <type_traits>
|
||||
#include <unordered_map>
|
||||
|
||||
#define CLASSPARAM(...)
|
||||
#define STRUCTPARAM(...)
|
||||
|
||||
#include <Geode/GeneratedBinding.hpp>
|
|
@ -1,302 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <Geode/Prelude.hpp>
|
||||
#include <Geode/c++stl/gdstdlib.hpp>
|
||||
#include <Geode/platform/platform.hpp>
|
||||
#include <variant>
|
||||
|
||||
#if defined(GEODE_EXPOSE_SECRET_INTERNALS_IN_HEADERS_DO_NOT_DEFINE_PLEASE)
|
||||
#if !defined(__clang__)
|
||||
#error Geode Loader only compiles with Clang.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(GEODE_CONCAT)
|
||||
#define GEODE_WRAPPER_CONCAT(x, y) x##y
|
||||
#define GEODE_CONCAT(x, y) GEODE_WRAPPER_CONCAT(x, y)
|
||||
#endif
|
||||
|
||||
#define GEODE_WRAPPER_STR(...) #__VA_ARGS__
|
||||
#define GEODE_STR(...) GEODE_WRAPPER_STR(__VA_ARGS__)
|
||||
|
||||
#define GEODE_PAD(size) uint8_t GEODE_CONCAT(__pad, __LINE__)[size]
|
||||
#define GEODE_UNIMPLEMENTED_PAD private:
|
||||
|
||||
#define GEODE_NONINHERITED_MEMBERS private:
|
||||
|
||||
#define GEODE_EXPAND(x) x
|
||||
#define GEODE_INVOKE(macro, ...) GEODE_EXPAND(macro(__VA_ARGS__))
|
||||
|
||||
namespace geode {
|
||||
struct ZeroConstructorType {};
|
||||
|
||||
static constexpr auto ZeroConstructor = ZeroConstructorType();
|
||||
|
||||
struct CutoffConstructorType {};
|
||||
|
||||
static constexpr auto CutoffConstructor = CutoffConstructorType();
|
||||
}
|
||||
|
||||
#define GEODE_CUSTOM_CONSTRUCTOR_BEGIN(Class_) \
|
||||
GEODE_ZERO_CONSTRUCTOR_BEGIN(Class_) \
|
||||
GEODE_CUTOFF_CONSTRUCTOR_BEGIN(Class_)
|
||||
|
||||
#define GEODE_CUSTOM_CONSTRUCTOR_COCOS(Class_, Base_) \
|
||||
GEODE_ZERO_CONSTRUCTOR(Class_, Base_) \
|
||||
GEODE_CUTOFF_CONSTRUCTOR_COCOS(Class_, Base_)
|
||||
|
||||
#define GEODE_CUSTOM_CONSTRUCTOR_GD(Class_, Base_) \
|
||||
GEODE_ZERO_CONSTRUCTOR(Class_, Base_) \
|
||||
GEODE_CUTOFF_CONSTRUCTOR_GD(Class_, Base_)
|
||||
|
||||
#define GEODE_CUSTOM_CONSTRUCTOR_CUTOFF(Class_, Base_) \
|
||||
GEODE_ZERO_CONSTRUCTOR(Class_, Base_) \
|
||||
GEODE_CUTOFF_CONSTRUCTOR_CUTOFF(Class_, Base_)
|
||||
|
||||
#define GEODE_ZERO_CONSTRUCTOR_BEGIN(Class_) \
|
||||
Class_(geode::ZeroConstructorType, void*) {} \
|
||||
Class_(geode::ZeroConstructorType, size_t fill) : \
|
||||
Class_(geode::ZeroConstructor, std::memset(static_cast<void*>(this), 0, fill)) {} \
|
||||
Class_(geode::ZeroConstructorType) : Class_(geode::ZeroConstructor, nullptr) {}
|
||||
|
||||
#define GEODE_ZERO_CONSTRUCTOR(Class_, Base_) \
|
||||
Class_(geode::ZeroConstructorType, size_t fill) : Base_(geode::ZeroConstructor, fill) {} \
|
||||
Class_(geode::ZeroConstructorType) : Base_(geode::ZeroConstructor, sizeof(Class_)) {}
|
||||
|
||||
#define GEODE_FILL_CONSTRUCTOR(Class_, Offset_) \
|
||||
Class_(geode::CutoffConstructorType, size_t fill) : \
|
||||
Class_( \
|
||||
geode::CutoffConstructor, \
|
||||
std::memset(reinterpret_cast<std::byte*>(this) + Offset_, 0, fill - Offset_) \
|
||||
) {} \
|
||||
Class_(geode::CutoffConstructorType, void*)
|
||||
|
||||
#define GEODE_CUTOFF_CONSTRUCTOR_BEGIN(Class_) \
|
||||
GEODE_MACOS(GEODE_FILL_CONSTRUCTOR(Class_, 0){}) \
|
||||
GEODE_IOS(GEODE_FILL_CONSTRUCTOR(Class_, 0){}) \
|
||||
GEODE_WINDOWS(Class_(geode::CutoffConstructorType, size_t fill) \
|
||||
: Class_() {}) \
|
||||
GEODE_ANDROID(GEODE_FILL_CONSTRUCTOR(Class_, 0){})
|
||||
|
||||
#define GEODE_CUTOFF_CONSTRUCTOR_COCOS(Class_, Base_) \
|
||||
GEODE_MACOS(Class_(geode::CutoffConstructorType, size_t fill) \
|
||||
: Base_(geode::CutoffConstructor, fill){}) \
|
||||
GEODE_IOS(Class_(geode::CutoffConstructorType, size_t fill) \
|
||||
: Base_(geode::CutoffConstructor, fill){}) \
|
||||
GEODE_WINDOWS(Class_(geode::CutoffConstructorType, size_t fill) \
|
||||
: Class_() {}) \
|
||||
GEODE_ANDROID(Class_(geode::CutoffConstructorType, size_t fill) \
|
||||
: Base_(geode::CutoffConstructor, fill){})
|
||||
|
||||
#define GEODE_CUTOFF_CONSTRUCTOR_GD(Class_, Base_) \
|
||||
GEODE_WINDOWS(Class_(geode::CutoffConstructorType, size_t fill) \
|
||||
: Base_(geode::CutoffConstructor, fill){}) \
|
||||
GEODE_MACOS(Class_(geode::CutoffConstructorType, size_t fill) \
|
||||
: Base_(geode::CutoffConstructor, fill){}) \
|
||||
GEODE_IOS(Class_(geode::CutoffConstructorType, size_t fill) \
|
||||
: Base_(geode::CutoffConstructor, fill){}) \
|
||||
GEODE_ANDROID(Class_(geode::CutoffConstructorType, size_t fill) \
|
||||
: Base_(geode::CutoffConstructor, fill){})
|
||||
|
||||
#define GEODE_CUTOFF_CONSTRUCTOR_CUTOFF(Class_, Base_) \
|
||||
GEODE_WINDOWS(GEODE_FILL_CONSTRUCTOR(Class_, sizeof(Base_)) : Base_(){}) \
|
||||
GEODE_ANDROID(Class_(geode::CutoffConstructorType, size_t fill) \
|
||||
: Base_(geode::CutoffConstructor, fill){}) \
|
||||
GEODE_MACOS(Class_(geode::CutoffConstructorType, size_t fill) \
|
||||
: Base_(geode::CutoffConstructor, fill){}) \
|
||||
GEODE_IOS(Class_(geode::CutoffConstructorType, size_t fill) \
|
||||
: Base_(geode::CutoffConstructor, fill){})
|
||||
|
||||
#define GEODE_NUMBER_OF_ARGS(...) \
|
||||
GEODE_EXPAND(GEODE_NUMBER_OF_ARGS_(__VA_ARGS__, GEODE_NUMBER_SEQUENCE(), ))
|
||||
#define GEODE_NUMBER_OF_ARGS_(...) GEODE_EXPAND(GEODE_NUMBER_OF_ARGS_N(__VA_ARGS__))
|
||||
#define GEODE_NUMBER_OF_ARGS_N( \
|
||||
_1, \
|
||||
_2, \
|
||||
_3, \
|
||||
_4, \
|
||||
_5, \
|
||||
_6, \
|
||||
_7, \
|
||||
_8, \
|
||||
_9, \
|
||||
_10, \
|
||||
_11, \
|
||||
_12, \
|
||||
_13, \
|
||||
_14, \
|
||||
_15, \
|
||||
_16, \
|
||||
_17, \
|
||||
_18, \
|
||||
_19, \
|
||||
_20, \
|
||||
_21, \
|
||||
_22, \
|
||||
_23, \
|
||||
_24, \
|
||||
_25, \
|
||||
_26, \
|
||||
_27, \
|
||||
_28, \
|
||||
_29, \
|
||||
_30, \
|
||||
_31, \
|
||||
_32, \
|
||||
_33, \
|
||||
_34, \
|
||||
_35, \
|
||||
_36, \
|
||||
_37, \
|
||||
_38, \
|
||||
_39, \
|
||||
_40, \
|
||||
_41, \
|
||||
_42, \
|
||||
_43, \
|
||||
_44, \
|
||||
_45, \
|
||||
_46, \
|
||||
_47, \
|
||||
_48, \
|
||||
_49, \
|
||||
_50, \
|
||||
_51, \
|
||||
_52, \
|
||||
_53, \
|
||||
_54, \
|
||||
_55, \
|
||||
_56, \
|
||||
_57, \
|
||||
_58, \
|
||||
_59, \
|
||||
_60, \
|
||||
_61, \
|
||||
_62, \
|
||||
_63, \
|
||||
N, \
|
||||
... \
|
||||
) \
|
||||
N
|
||||
#define GEODE_NUMBER_SEQUENCE() \
|
||||
63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
|
||||
40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, \
|
||||
18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
|
||||
|
||||
#define $execute \
|
||||
template <class> \
|
||||
void GEODE_CONCAT(geodeExecFunction, __LINE__)(); \
|
||||
namespace { \
|
||||
struct GEODE_CONCAT(ExecFuncUnique, __LINE__) {}; \
|
||||
} \
|
||||
static inline auto GEODE_CONCAT(Exec, __LINE__) = \
|
||||
(GEODE_CONCAT(geodeExecFunction, __LINE__) < GEODE_CONCAT(ExecFuncUnique, __LINE__) > (), \
|
||||
0); \
|
||||
template <class> \
|
||||
void GEODE_CONCAT(geodeExecFunction, __LINE__)()
|
||||
|
||||
#define GEODE_FORWARD_COMPAT_DISABLE_HOOKS_INNER(message) \
|
||||
if (Loader::get()->isForwardCompatMode()) { \
|
||||
if (strlen(message)) { \
|
||||
log::warn("[Forward Compat] " message); \
|
||||
} \
|
||||
for (const auto& [_, hook] : self.m_hooks) { \
|
||||
hook->setAutoEnable(false); \
|
||||
} \
|
||||
}
|
||||
#define GEODE_FORWARD_COMPAT_ENABLE_HOOKS_INNER(message) \
|
||||
if (!Loader::get()->isForwardCompatMode()) { \
|
||||
if (strlen(message)) { \
|
||||
log::warn("[Forward Compat] " message); \
|
||||
} \
|
||||
for (const auto& [_, hook] : self.m_hooks) { \
|
||||
hook->setAutoEnable(false); \
|
||||
} \
|
||||
}
|
||||
#define GEODE_FORWARD_COMPAT_DISABLE_HOOKS(message) \
|
||||
static void onModify(const auto& self) { \
|
||||
GEODE_FORWARD_COMPAT_DISABLE_HOOKS_INNER(message) \
|
||||
}
|
||||
#define GEODE_FORWARD_COMPAT_ENABLE_HOOKS(message) \
|
||||
static void onModify(const auto& self) { \
|
||||
GEODE_FORWARD_COMPAT_ENABLE_HOOKS_INNER(message) \
|
||||
}
|
||||
|
||||
// #define GEODE_NEST1(macro, begin) \
|
||||
// macro(GEODE_CONCAT(begin, 0)), \
|
||||
// macro(GEODE_CONCAT(begin, 1)), \
|
||||
// macro(GEODE_CONCAT(begin, 2)), \
|
||||
// macro(GEODE_CONCAT(begin, 3)), \
|
||||
// macro(GEODE_CONCAT(begin, 4)), \
|
||||
// macro(GEODE_CONCAT(begin, 5)), \
|
||||
// macro(GEODE_CONCAT(begin, 6)), \
|
||||
// macro(GEODE_CONCAT(begin, 7)), \
|
||||
// macro(GEODE_CONCAT(begin, 8)), \
|
||||
// macro(GEODE_CONCAT(begin, 9)), \
|
||||
// macro(GEODE_CONCAT(begin, a)), \
|
||||
// macro(GEODE_CONCAT(begin, b)), \
|
||||
// macro(GEODE_CONCAT(begin, c)), \
|
||||
// macro(GEODE_CONCAT(begin, d)), \
|
||||
// macro(GEODE_CONCAT(begin, e)), \
|
||||
// macro(GEODE_CONCAT(begin, f))
|
||||
|
||||
// #define GEODE_NEST2(macro, begin) \
|
||||
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 0)), \
|
||||
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 1)), \
|
||||
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 2)), \
|
||||
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 3)), \
|
||||
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 4)), \
|
||||
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 5)), \
|
||||
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 6)), \
|
||||
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 7)), \
|
||||
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 8)), \
|
||||
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 9)), \
|
||||
// GEODE_NEST1(macro, GEODE_CONCAT(begin, a)), \
|
||||
// GEODE_NEST1(macro, GEODE_CONCAT(begin, b)), \
|
||||
// GEODE_NEST1(macro, GEODE_CONCAT(begin, c)), \
|
||||
// GEODE_NEST1(macro, GEODE_CONCAT(begin, d)), \
|
||||
// GEODE_NEST1(macro, GEODE_CONCAT(begin, e)), \
|
||||
// GEODE_NEST1(macro, GEODE_CONCAT(begin, f))
|
||||
|
||||
// #define GEODE_NEST3(macro, begin) \
|
||||
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 0)), \
|
||||
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 1)), \
|
||||
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 2)), \
|
||||
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 3)), \
|
||||
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 4)), \
|
||||
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 5)), \
|
||||
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 6)), \
|
||||
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 7)), \
|
||||
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 8)), \
|
||||
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 9)), \
|
||||
// GEODE_NEST2(macro, GEODE_CONCAT(begin, a)), \
|
||||
// GEODE_NEST2(macro, GEODE_CONCAT(begin, b)), \
|
||||
// GEODE_NEST2(macro, GEODE_CONCAT(begin, c)), \
|
||||
// GEODE_NEST2(macro, GEODE_CONCAT(begin, d)), \
|
||||
// GEODE_NEST2(macro, GEODE_CONCAT(begin, e)), \
|
||||
// GEODE_NEST2(macro, GEODE_CONCAT(begin, f))
|
||||
|
||||
// #define GEODE_NEST4(macro, begin) \
|
||||
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 0)), \
|
||||
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 1)), \
|
||||
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 2)), \
|
||||
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 3)), \
|
||||
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 4)), \
|
||||
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 5)), \
|
||||
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 6)), \
|
||||
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 7)), \
|
||||
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 8)), \
|
||||
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 9)), \
|
||||
// GEODE_NEST3(macro, GEODE_CONCAT(begin, a)), \
|
||||
// GEODE_NEST3(macro, GEODE_CONCAT(begin, b)), \
|
||||
// GEODE_NEST3(macro, GEODE_CONCAT(begin, c)), \
|
||||
// GEODE_NEST3(macro, GEODE_CONCAT(begin, d)), \
|
||||
// GEODE_NEST3(macro, GEODE_CONCAT(begin, e)), \
|
||||
// GEODE_NEST3(macro, GEODE_CONCAT(begin, f))
|
||||
|
||||
// #define GEODE_ENUM_OFFSETS_DEFINE(hex) GEODE_CONCAT($, hex)
|
||||
// #define GEODE_ENUM_OFFSETS_SET() GEODE_NEST4(GEODE_ENUM_OFFSETS_DEFINE, 0x)
|
||||
|
||||
// enum class PrinterOffsets {
|
||||
// GEODE_ENUM_OFFSETS_SET()
|
||||
// };
|
|
@ -1,7 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "Bindings.hpp"
|
||||
#include "Loader.hpp"
|
||||
#include "UI.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include "modify/Modify.hpp" // doesn't include generated modify
|
|
@ -1,12 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "loader/Hook.hpp"
|
||||
#include "loader/Loader.hpp"
|
||||
#include "loader/Log.hpp"
|
||||
#include "loader/Mod.hpp"
|
||||
#include "loader/ModEvent.hpp"
|
||||
#include "loader/EventV2.hpp"
|
||||
#include "loader/Setting.hpp"
|
||||
#include "loader/Dirs.hpp"
|
||||
|
||||
#include <Geode/DefaultInclude.hpp>
|
|
@ -1,7 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "modify/Modify.hpp"
|
||||
|
||||
#include <Geode/GeneratedModify.hpp>
|
||||
|
||||
using namespace geode::modifier;
|
|
@ -1,34 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
// Because C++ doesn't like using
|
||||
// namespaces that don't exist
|
||||
namespace geode {
|
||||
namespace addresser {}
|
||||
namespace cast {}
|
||||
namespace cocos {}
|
||||
namespace utils {}
|
||||
namespace helper {}
|
||||
namespace op {}
|
||||
namespace stream {}
|
||||
namespace view {}
|
||||
}
|
||||
|
||||
namespace cocos2d {
|
||||
namespace extension {}
|
||||
}
|
||||
|
||||
namespace geode {
|
||||
namespace prelude {
|
||||
using namespace ::geode;
|
||||
using namespace ::geode::addresser;
|
||||
using namespace ::geode::cast;
|
||||
using namespace ::geode::cocos;
|
||||
using namespace ::geode::helper;
|
||||
using namespace ::geode::utils;
|
||||
using namespace ::geode::op;
|
||||
using namespace ::geode::stream;
|
||||
using namespace ::geode::view;
|
||||
using namespace ::cocos2d;
|
||||
using namespace ::cocos2d::extension;
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "ui/BasedButton.hpp"
|
||||
#include "ui/Border.hpp"
|
||||
#include "ui/ColorPickPopup.hpp"
|
||||
#include "ui/EnterLayerEvent.hpp"
|
||||
#include "ui/BasedButtonSprite.hpp"
|
||||
#include "ui/IconButtonSprite.hpp"
|
||||
#include "ui/Layout.hpp"
|
||||
#include "ui/SpacerNode.hpp"
|
||||
#include "ui/General.hpp"
|
||||
#include "ui/ListView.hpp"
|
||||
#include "ui/MDPopup.hpp"
|
||||
#include "ui/MDTextArea.hpp"
|
||||
#include "ui/Notification.hpp"
|
||||
#include "ui/Popup.hpp"
|
||||
#include "ui/SceneManager.hpp"
|
||||
#include "ui/ScrollLayer.hpp"
|
||||
#include "ui/SelectList.hpp"
|
||||
#include "ui/SimpleAxisLayout.hpp"
|
||||
#include "ui/Scrollbar.hpp"
|
||||
#include "ui/TextArea.hpp"
|
||||
#include "ui/TextRenderer.hpp"
|
|
@ -1,14 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "DefaultInclude.hpp"
|
||||
#include "utils/VersionInfo.hpp"
|
||||
#include "utils/ranges.hpp"
|
||||
#include "utils/casts.hpp"
|
||||
#include "utils/cocos.hpp"
|
||||
#include "utils/map.hpp"
|
||||
#include "utils/string.hpp"
|
||||
#include "utils/file.hpp"
|
||||
#include "utils/permission.hpp"
|
||||
#include "utils/general.hpp"
|
||||
#include "utils/timer.hpp"
|
||||
#include "utils/ObjcHook.hpp"
|
|
@ -1,24 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <set>
|
||||
|
||||
namespace gd {
|
||||
template <class T>
|
||||
using vector = std::vector<T>;
|
||||
|
||||
template <class K, class V>
|
||||
using map = std::map<K, V>;
|
||||
|
||||
template <class K, class V>
|
||||
using unordered_map = std::unordered_map<K, V>;
|
||||
|
||||
template <class K>
|
||||
using set = std::set<K>;
|
||||
|
||||
template <class K>
|
||||
using unordered_set = std::unordered_set<K>;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <Geode/platform/platform.hpp>
|
||||
|
||||
#include "string.hpp"
|
||||
|
||||
#if defined(GEODE_IS_ANDROID)
|
||||
#include "gnustl.hpp"
|
||||
#else
|
||||
#include "aliastl.hpp"
|
||||
#endif
|
|
@ -1,347 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
namespace geode::stl {
|
||||
struct _rb_tree_base {
|
||||
bool m_isblack;
|
||||
_rb_tree_base* m_parent;
|
||||
_rb_tree_base* m_left;
|
||||
_rb_tree_base* m_right;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct _rb_tree_node : public _rb_tree_base {
|
||||
T m_value;
|
||||
};
|
||||
|
||||
inline void _rb_tree_rotate_left(_rb_tree_base* const x, _rb_tree_base*& root);
|
||||
inline void _rb_tree_rotate_right(_rb_tree_base* const x, _rb_tree_base*& root);
|
||||
inline void _rb_insert_rebalance(
|
||||
bool const insert_left, _rb_tree_base* x, _rb_tree_base* p, _rb_tree_base& header
|
||||
);
|
||||
inline _rb_tree_base* _rb_increment(_rb_tree_base* __x) noexcept;
|
||||
inline _rb_tree_base* _rb_decrement(_rb_tree_base* __x) noexcept;
|
||||
inline _rb_tree_base* _rb_rebalance_for_erase(_rb_tree_base* const __z, _rb_tree_base& __header) noexcept;
|
||||
|
||||
template <typename T>
|
||||
struct _rb_tree_iterator {
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef T* pointer;
|
||||
|
||||
typedef _rb_tree_iterator<T> _Self;
|
||||
typedef _rb_tree_base* _Base_ptr;
|
||||
typedef _rb_tree_node<T>* _Link_type;
|
||||
|
||||
_rb_tree_iterator() : m_node() {}
|
||||
|
||||
explicit _rb_tree_iterator(_Base_ptr __x) noexcept : m_node(__x) {}
|
||||
|
||||
reference operator*() const noexcept {
|
||||
return static_cast<_Link_type>(m_node)->m_value;
|
||||
}
|
||||
|
||||
pointer operator->() const noexcept {
|
||||
return &static_cast<_Link_type>(m_node)->m_value;
|
||||
}
|
||||
|
||||
_Self& operator++() noexcept {
|
||||
m_node = _rb_increment(m_node);
|
||||
return *this;
|
||||
}
|
||||
|
||||
_Self operator++(int) noexcept {
|
||||
_Self __tmp = *this;
|
||||
m_node = _rb_increment(m_node);
|
||||
return __tmp;
|
||||
}
|
||||
|
||||
_Self& operator--() noexcept {
|
||||
m_node = _rb_decrement(m_node);
|
||||
return *this;
|
||||
}
|
||||
|
||||
_Self operator--(int) noexcept {
|
||||
_Self __tmp = *this;
|
||||
m_node = _rb_decrement(m_node);
|
||||
return __tmp;
|
||||
}
|
||||
|
||||
bool operator==(_Self const& __x) const noexcept {
|
||||
return m_node == __x.m_node;
|
||||
}
|
||||
|
||||
bool operator!=(_Self const& __x) const noexcept {
|
||||
return m_node != __x.m_node;
|
||||
}
|
||||
|
||||
_Base_ptr m_node;
|
||||
};
|
||||
|
||||
inline void _rb_tree_rotate_left(_rb_tree_base* const x, _rb_tree_base*& root) {
|
||||
_rb_tree_base* const y = x->m_right;
|
||||
|
||||
x->m_right = y->m_left;
|
||||
if (y->m_left != 0) y->m_left->m_parent = x;
|
||||
y->m_parent = x->m_parent;
|
||||
|
||||
if (x == root) root = y;
|
||||
else if (x == x->m_parent->m_left) x->m_parent->m_left = y;
|
||||
else x->m_parent->m_right = y;
|
||||
y->m_left = x;
|
||||
x->m_parent = y;
|
||||
}
|
||||
|
||||
inline void _rb_tree_rotate_right(_rb_tree_base* const x, _rb_tree_base*& root) {
|
||||
_rb_tree_base* const y = x->m_left;
|
||||
|
||||
x->m_left = y->m_right;
|
||||
if (y->m_right != 0) y->m_right->m_parent = x;
|
||||
y->m_parent = x->m_parent;
|
||||
|
||||
if (x == root) root = y;
|
||||
else if (x == x->m_parent->m_right) x->m_parent->m_right = y;
|
||||
else x->m_parent->m_left = y;
|
||||
y->m_right = x;
|
||||
x->m_parent = y;
|
||||
}
|
||||
|
||||
inline void _rb_insert_rebalance(
|
||||
bool const insert_left, _rb_tree_base* x, _rb_tree_base* p, _rb_tree_base& header
|
||||
) {
|
||||
_rb_tree_base*& root = header.m_parent;
|
||||
|
||||
x->m_parent = p;
|
||||
x->m_left = 0;
|
||||
x->m_right = 0;
|
||||
x->m_isblack = false;
|
||||
|
||||
if (insert_left) {
|
||||
p->m_left = x;
|
||||
|
||||
if (p == &header) {
|
||||
header.m_parent = x;
|
||||
header.m_right = x;
|
||||
}
|
||||
else if (p == header.m_left) {
|
||||
header.m_left = x;
|
||||
}
|
||||
}
|
||||
else {
|
||||
p->m_right = x;
|
||||
|
||||
if (p == header.m_right) {
|
||||
header.m_right = x;
|
||||
}
|
||||
}
|
||||
|
||||
while (x != root && x->m_parent->m_isblack == false) {
|
||||
_rb_tree_base* const xpp = x->m_parent->m_parent;
|
||||
|
||||
if (x->m_parent == xpp->m_left) {
|
||||
_rb_tree_base* const y = xpp->m_right;
|
||||
if (y && y->m_isblack == false) {
|
||||
x->m_parent->m_isblack = true;
|
||||
y->m_isblack = true;
|
||||
xpp->m_isblack = false;
|
||||
x = xpp;
|
||||
}
|
||||
else {
|
||||
if (x == x->m_parent->m_right) {
|
||||
x = x->m_parent;
|
||||
_rb_tree_rotate_left(x, root);
|
||||
}
|
||||
x->m_parent->m_isblack = true;
|
||||
xpp->m_isblack = false;
|
||||
_rb_tree_rotate_right(xpp, root);
|
||||
}
|
||||
}
|
||||
else {
|
||||
_rb_tree_base* const y = xpp->m_left;
|
||||
if (y && y->m_isblack == false) {
|
||||
x->m_parent->m_isblack = true;
|
||||
y->m_isblack = true;
|
||||
xpp->m_isblack = false;
|
||||
x = xpp;
|
||||
}
|
||||
else {
|
||||
if (x == x->m_parent->m_left) {
|
||||
x = x->m_parent;
|
||||
_rb_tree_rotate_right(x, root);
|
||||
}
|
||||
x->m_parent->m_isblack = true;
|
||||
xpp->m_isblack = false;
|
||||
_rb_tree_rotate_left(xpp, root);
|
||||
}
|
||||
}
|
||||
}
|
||||
root->m_isblack = true;
|
||||
}
|
||||
|
||||
inline _rb_tree_base* _rb_increment(_rb_tree_base* __x) noexcept {
|
||||
if (__x->m_right != 0) {
|
||||
__x = __x->m_right;
|
||||
while (__x->m_left != 0)
|
||||
__x = __x->m_left;
|
||||
}
|
||||
else {
|
||||
_rb_tree_base* __y = __x->m_parent;
|
||||
while (__x == __y->m_right) {
|
||||
__x = __y;
|
||||
__y = __y->m_parent;
|
||||
}
|
||||
if (__x->m_right != __y) __x = __y;
|
||||
}
|
||||
return __x;
|
||||
}
|
||||
|
||||
inline _rb_tree_base* _rb_decrement(_rb_tree_base* __x) noexcept {
|
||||
if (!__x->m_isblack && __x->m_parent->m_parent == __x) __x = __x->m_right;
|
||||
else if (__x->m_left != 0) {
|
||||
_rb_tree_base* __y = __x->m_left;
|
||||
while (__y->m_right != 0)
|
||||
__y = __y->m_right;
|
||||
__x = __y;
|
||||
}
|
||||
else {
|
||||
_rb_tree_base* __y = __x->m_parent;
|
||||
while (__x == __y->m_left) {
|
||||
__x = __y;
|
||||
__y = __y->m_parent;
|
||||
}
|
||||
__x = __y;
|
||||
}
|
||||
return __x;
|
||||
}
|
||||
|
||||
inline _rb_tree_base* _rb_rebalance_for_erase(
|
||||
_rb_tree_base* const __z, _rb_tree_base& __header
|
||||
) noexcept {
|
||||
_rb_tree_base*& __root = __header.m_parent;
|
||||
_rb_tree_base*& __leftmost = __header.m_left;
|
||||
_rb_tree_base*& __rightmost = __header.m_right;
|
||||
_rb_tree_base* __y = __z;
|
||||
_rb_tree_base* __x = 0;
|
||||
_rb_tree_base* __x_parent = 0;
|
||||
|
||||
if (__y->m_left == 0) // __z has at most one non-null child. y == z.
|
||||
__x = __y->m_right; // __x might be null.
|
||||
else if (__y->m_right == 0) // __z has exactly one non-null child. y == z.
|
||||
__x = __y->m_left; // __x is not null.
|
||||
else {
|
||||
// __z has two non-null children. Set __y to
|
||||
__y = __y->m_right; // __z's successor. __x might be null.
|
||||
while (__y->m_left != 0)
|
||||
__y = __y->m_left;
|
||||
__x = __y->m_right;
|
||||
}
|
||||
if (__y != __z) {
|
||||
// relink y in place of z. y is z's successor
|
||||
__z->m_left->m_parent = __y;
|
||||
__y->m_left = __z->m_left;
|
||||
if (__y != __z->m_right) {
|
||||
__x_parent = __y->m_parent;
|
||||
if (__x) __x->m_parent = __y->m_parent;
|
||||
__y->m_parent->m_left = __x; // __y must be a child of m_left
|
||||
__y->m_right = __z->m_right;
|
||||
__z->m_right->m_parent = __y;
|
||||
}
|
||||
else __x_parent = __y;
|
||||
if (__root == __z) __root = __y;
|
||||
else if (__z->m_parent->m_left == __z) __z->m_parent->m_left = __y;
|
||||
else __z->m_parent->m_right = __y;
|
||||
__y->m_parent = __z->m_parent;
|
||||
std::swap(__y->m_isblack, __z->m_isblack);
|
||||
__y = __z;
|
||||
// __y now points to node to be actually deleted
|
||||
}
|
||||
else { // __y == __z
|
||||
__x_parent = __y->m_parent;
|
||||
if (__x) __x->m_parent = __y->m_parent;
|
||||
if (__root == __z) __root = __x;
|
||||
else if (__z->m_parent->m_left == __z) __z->m_parent->m_left = __x;
|
||||
else __z->m_parent->m_right = __x;
|
||||
if (__leftmost == __z) {
|
||||
if (__z->m_right == 0) // __z->m_left must be null also
|
||||
__leftmost = __z->m_parent;
|
||||
// makes __leftmost == _M_header if __z == __root
|
||||
else {
|
||||
__leftmost = __x;
|
||||
while (__leftmost->m_left != 0)
|
||||
__leftmost = __leftmost->m_left;
|
||||
}
|
||||
}
|
||||
if (__rightmost == __z) {
|
||||
if (__z->m_left == 0) // __z->m_right must be null also
|
||||
__rightmost = __z->m_parent;
|
||||
// makes __rightmost == _M_header if __z == __root
|
||||
else { // __x == __z->m_left
|
||||
__rightmost = __x;
|
||||
while (__rightmost->m_right != 0)
|
||||
__rightmost = __rightmost->m_right;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (__y->m_isblack != false) {
|
||||
while (__x != __root && (__x == 0 || __x->m_isblack))
|
||||
if (__x == __x_parent->m_left) {
|
||||
_rb_tree_base* __w = __x_parent->m_right;
|
||||
if (__w->m_isblack == false) {
|
||||
__w->m_isblack = true;
|
||||
__x_parent->m_isblack = false;
|
||||
_rb_tree_rotate_left(__x_parent, __root);
|
||||
__w = __x_parent->m_right;
|
||||
}
|
||||
if ((__w->m_left == 0 || __w->m_left->m_isblack == true) &&
|
||||
(__w->m_right == 0 || __w->m_right->m_isblack == true)) {
|
||||
__w->m_isblack = false;
|
||||
__x = __x_parent;
|
||||
__x_parent = __x_parent->m_parent;
|
||||
}
|
||||
else {
|
||||
if (__w->m_right == 0 || __w->m_right->m_isblack == true) {
|
||||
__w->m_left->m_isblack = true;
|
||||
__w->m_isblack = false;
|
||||
_rb_tree_rotate_right(__w, __root);
|
||||
__w = __x_parent->m_right;
|
||||
}
|
||||
__w->m_isblack = __x_parent->m_isblack;
|
||||
__x_parent->m_isblack = true;
|
||||
if (__w->m_right) __w->m_right->m_isblack = true;
|
||||
_rb_tree_rotate_left(__x_parent, __root);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// same as above, with m_right <-> m_left.
|
||||
_rb_tree_base* __w = __x_parent->m_left;
|
||||
if (__w->m_isblack == false) {
|
||||
__w->m_isblack = true;
|
||||
__x_parent->m_isblack = false;
|
||||
_rb_tree_rotate_right(__x_parent, __root);
|
||||
__w = __x_parent->m_left;
|
||||
}
|
||||
if ((__w->m_right == 0 || __w->m_right->m_isblack == true) &&
|
||||
(__w->m_left == 0 || __w->m_left->m_isblack == true)) {
|
||||
__w->m_isblack = false;
|
||||
__x = __x_parent;
|
||||
__x_parent = __x_parent->m_parent;
|
||||
}
|
||||
else {
|
||||
if (__w->m_left == 0 || __w->m_left->m_isblack == true) {
|
||||
__w->m_right->m_isblack = true;
|
||||
__w->m_isblack = false;
|
||||
_rb_tree_rotate_left(__w, __root);
|
||||
__w = __x_parent->m_left;
|
||||
}
|
||||
__w->m_isblack = __x_parent->m_isblack;
|
||||
__x_parent->m_isblack = true;
|
||||
if (__w->m_left) __w->m_left->m_isblack = true;
|
||||
_rb_tree_rotate_right(__x_parent, __root);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (__x) __x->m_isblack = true;
|
||||
}
|
||||
return __y;
|
||||
}
|
||||
}
|
|
@ -1,796 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
namespace geode::base {
|
||||
uintptr_t get();
|
||||
}
|
||||
|
||||
#if defined(GEODE_IS_ANDROID)
|
||||
|
||||
#include "gnustl-map.hpp"
|
||||
#include "gnustl/stl_set.h"
|
||||
#include "gnustl/unordered_map.hpp"
|
||||
#include "gnustl/unordered_set.hpp"
|
||||
#include "gnustl/hash_specialization.hpp"
|
||||
#undef _GLIBCXX_RELEASE
|
||||
#undef __GLIBCXX__
|
||||
#undef _GLIBCXX_USE_DUAL_ABI
|
||||
|
||||
namespace gd {
|
||||
using namespace geode::stl;
|
||||
|
||||
void* operatorNew(size_t size);
|
||||
void operatorDelete(void* ptr);
|
||||
|
||||
template <typename T>
|
||||
class allocator : public std::allocator<T> {
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef T* pointer;
|
||||
typedef const T* const_pointer;
|
||||
|
||||
template<typename _Tp1>
|
||||
struct rebind {
|
||||
typedef allocator<_Tp1> other;
|
||||
};
|
||||
|
||||
pointer allocate(size_type n, const void *hint=0) {
|
||||
return (pointer)operatorNew(n * sizeof(T));
|
||||
}
|
||||
|
||||
void deallocate(pointer p, size_type n) {
|
||||
return operatorDelete(p);
|
||||
}
|
||||
|
||||
allocator() throw(): std::allocator<T>() { }
|
||||
allocator(const allocator &a) throw(): std::allocator<T>(a) { }
|
||||
template <class U>
|
||||
allocator(const allocator<U> &a) throw(): std::allocator<T>(a) { }
|
||||
~allocator() throw() { }
|
||||
};
|
||||
|
||||
template <typename K, typename V>
|
||||
class GEODE_DLL map {
|
||||
protected:
|
||||
std::less<K> compare;
|
||||
_rb_tree_base m_header;
|
||||
size_t m_nodecount;
|
||||
|
||||
public:
|
||||
typedef _rb_tree_node<std::pair<K, V>>* _tree_node;
|
||||
typedef _rb_tree_iterator<std::pair<K, V>> iterator;
|
||||
|
||||
std::map<K, V> std() {
|
||||
return (std::map<K, V>)(*this);
|
||||
}
|
||||
|
||||
operator std::map<K, V>() {
|
||||
auto iter_node = static_cast<_tree_node>(m_header.m_left);
|
||||
auto end_node = static_cast<_tree_node>(&m_header);
|
||||
std::map<K, V> out;
|
||||
for (; iter_node != end_node;
|
||||
iter_node = static_cast<_tree_node>(_rb_increment(iter_node))) {
|
||||
out[iter_node->m_value.first] = iter_node->m_value.second;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
operator std::map<K, V>() const {
|
||||
auto iter_node = static_cast<_tree_node>(m_header.m_left);
|
||||
auto end_node = (_tree_node)(&m_header);
|
||||
std::map<K, V> out;
|
||||
for (; iter_node != end_node;
|
||||
iter_node = static_cast<_tree_node>(_rb_increment(iter_node))) {
|
||||
out[iter_node->m_value.first] = iter_node->m_value.second;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
void insert(_tree_node x, _tree_node p, std::pair<K, V> const& val) {
|
||||
bool insert_left =
|
||||
(x != 0 || p == static_cast<_tree_node>(&m_header) || val.first < p->m_value.first);
|
||||
|
||||
_tree_node z = new _rb_tree_node<std::pair<K, V>>();
|
||||
z->m_value = val;
|
||||
|
||||
_rb_insert_rebalance(insert_left, z, p, m_header);
|
||||
++m_nodecount;
|
||||
}
|
||||
|
||||
void insert(std::pair<K, V> const& val) {
|
||||
insert_pair(val);
|
||||
}
|
||||
|
||||
void insert_pair(std::pair<K, V> const& val) {
|
||||
_tree_node x = static_cast<_tree_node>(m_header.m_parent);
|
||||
_tree_node y = static_cast<_tree_node>(&m_header);
|
||||
bool comp = true;
|
||||
while (x != 0) {
|
||||
y = x;
|
||||
comp = val.first < x->m_value.first;
|
||||
x = comp ? static_cast<_tree_node>(x->m_left) : static_cast<_tree_node>(x->m_right);
|
||||
}
|
||||
auto iter = y;
|
||||
|
||||
if (comp) {
|
||||
if (iter == static_cast<_tree_node>(m_header.m_left)) {
|
||||
insert(x, y, val);
|
||||
}
|
||||
else {
|
||||
iter = static_cast<_tree_node>(_rb_decrement(iter));
|
||||
}
|
||||
}
|
||||
if (iter->m_value.first < val.first) {
|
||||
insert(x, y, val);
|
||||
}
|
||||
}
|
||||
|
||||
map(std::map<K, V> input) {
|
||||
m_header.m_isblack = false;
|
||||
m_header.m_parent = 0;
|
||||
m_header.m_left = &m_header;
|
||||
m_header.m_right = &m_header;
|
||||
|
||||
for (auto i : input) {
|
||||
insert_pair(i);
|
||||
}
|
||||
}
|
||||
|
||||
void erase(_tree_node x) {
|
||||
while (x != 0) {
|
||||
erase(static_cast<_tree_node>(x->m_right));
|
||||
auto y = static_cast<_tree_node>(x->m_left);
|
||||
delete y;
|
||||
x = y;
|
||||
}
|
||||
}
|
||||
|
||||
std::pair<iterator, iterator> equal_range(K const& __k) {
|
||||
return std::pair<iterator, iterator>(lower_bound(__k), upper_bound(__k));
|
||||
}
|
||||
|
||||
size_t erase(K const& __x) {
|
||||
std::pair<iterator, iterator> __p = equal_range(__x);
|
||||
size_t __old = size();
|
||||
erase(__p.first, __p.second);
|
||||
return __old - size();
|
||||
}
|
||||
|
||||
void clear() {
|
||||
erase(static_cast<_tree_node>(m_header.m_parent));
|
||||
m_header.m_parent = 0;
|
||||
m_header.m_left = &m_header;
|
||||
m_header.m_right = &m_header;
|
||||
m_nodecount = 0;
|
||||
}
|
||||
|
||||
void erase(iterator __first, iterator __last) {
|
||||
if (__first == begin() && __last == end()) {
|
||||
clear();
|
||||
}
|
||||
else {
|
||||
while (__first != __last) {
|
||||
erase(__first++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void erase(iterator __pos) {
|
||||
_tree_node __y = static_cast<_tree_node>(_rb_rebalance_for_erase(
|
||||
__pos.m_node, m_header
|
||||
));
|
||||
delete __y;
|
||||
--m_nodecount;
|
||||
}
|
||||
|
||||
V& operator[](K const& __k) {
|
||||
iterator __i = lower_bound(__k);
|
||||
if (__i == end() || compare(__k, (*__i).first)) {
|
||||
insert_pair(std::pair<K, V>(__k, V()));
|
||||
__i = lower_bound(__k);
|
||||
}
|
||||
return (*__i).second;
|
||||
}
|
||||
|
||||
V& at(K const& __k) {
|
||||
iterator __i = lower_bound(__k);
|
||||
if (__i == end() || compare(__k, (*__i).first)) {
|
||||
throw std::out_of_range("map::at");
|
||||
}
|
||||
|
||||
return (*__i).second;
|
||||
}
|
||||
|
||||
const V& at(K const& __k) const {
|
||||
iterator __i = lower_bound(__k);
|
||||
if (__i == end() || compare(__k, (*__i).first)) {
|
||||
throw std::out_of_range("map::at");
|
||||
}
|
||||
|
||||
return (*__i).second;
|
||||
}
|
||||
|
||||
iterator begin() noexcept {
|
||||
return iterator(m_header.m_left);
|
||||
}
|
||||
|
||||
iterator end() noexcept {
|
||||
return iterator(&m_header);
|
||||
}
|
||||
|
||||
bool empty() const noexcept {
|
||||
return m_nodecount == 0;
|
||||
}
|
||||
|
||||
size_t size() const noexcept {
|
||||
return m_nodecount;
|
||||
}
|
||||
|
||||
iterator lower_bound(K const& __x) {
|
||||
_tree_node __j = static_cast<_tree_node>(m_header.m_parent);
|
||||
_tree_node __k = static_cast<_tree_node>(&m_header);
|
||||
while (__j != nullptr) {
|
||||
if (!compare(__j->m_value.first, __x)) {
|
||||
__k = __j;
|
||||
__j = static_cast<_tree_node>(__j->m_left);
|
||||
}
|
||||
else {
|
||||
__j = static_cast<_tree_node>(__j->m_right);
|
||||
}
|
||||
}
|
||||
return iterator(__k);
|
||||
}
|
||||
|
||||
iterator upper_bound(K const& __x) {
|
||||
_tree_node __j = static_cast<_tree_node>(m_header.m_parent);
|
||||
_tree_node __k = static_cast<_tree_node>(&m_header);
|
||||
while (__j != nullptr) {
|
||||
if (compare(__x, __j->m_value.first)) {
|
||||
__k = __j;
|
||||
__j = static_cast<_tree_node>(__j->m_left);
|
||||
}
|
||||
else {
|
||||
__j = static_cast<_tree_node>(__j->m_right);
|
||||
}
|
||||
}
|
||||
return iterator(__k);
|
||||
}
|
||||
|
||||
iterator find(K const& __x) {
|
||||
iterator __j = lower_bound(__x);
|
||||
return (__j == end() || compare(__x, (*__j).first)) ? end() : __j;
|
||||
}
|
||||
|
||||
size_t count(K const& __x) {
|
||||
return find(__x) != end() ? 1 : 0;
|
||||
}
|
||||
|
||||
bool contains(K const& __x) {
|
||||
return count(__x) > 0;
|
||||
}
|
||||
|
||||
map(map const& lol) : map(std::map<K, V>(lol)) {}
|
||||
|
||||
map() : map(std::map<K, V>()) {}
|
||||
|
||||
~map() {
|
||||
erase(static_cast<_tree_node>(m_header.m_parent));
|
||||
}
|
||||
};
|
||||
|
||||
// template <class Type>
|
||||
// using vector = std::vector<Type>;
|
||||
|
||||
template <typename T>
|
||||
class GEODE_DLL vector {
|
||||
public:
|
||||
using value_type = T;
|
||||
using iterator = T*;
|
||||
using const_iterator = const T*;
|
||||
|
||||
auto allocator() const {
|
||||
return gd::allocator<T>();
|
||||
}
|
||||
|
||||
operator std::vector<T>() const {
|
||||
return std::vector<T>(m_start, m_finish);
|
||||
}
|
||||
|
||||
vector() {
|
||||
m_start = nullptr;
|
||||
m_finish = nullptr;
|
||||
m_reserveEnd = nullptr;
|
||||
}
|
||||
|
||||
std::size_t nextCapacity(std::size_t x) {
|
||||
// minimum 16, powers of 2, don't use builtins
|
||||
if (x < 16) return 16;
|
||||
std::size_t out = 16;
|
||||
while (out < x) {
|
||||
out *= 2;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
vector(std::vector<T> const& input) : vector() {
|
||||
if (input.size()) {
|
||||
auto capacity = nextCapacity(input.size());
|
||||
m_start = this->allocator().allocate(capacity);
|
||||
m_finish = m_start + input.size();
|
||||
m_reserveEnd = m_start + capacity;
|
||||
|
||||
std::uninitialized_default_construct(m_start, m_finish);
|
||||
std::copy(input.begin(), input.end(), m_start);
|
||||
}
|
||||
}
|
||||
|
||||
vector(gd::vector<T> const& input) : vector() {
|
||||
if (input.size()) {
|
||||
auto capacity = nextCapacity(input.size());
|
||||
m_start = this->allocator().allocate(capacity);
|
||||
m_finish = m_start + input.size();
|
||||
m_reserveEnd = m_start + capacity;
|
||||
|
||||
std::uninitialized_default_construct(m_start, m_finish);
|
||||
std::copy(input.begin(), input.end(), m_start);
|
||||
}
|
||||
}
|
||||
|
||||
vector(gd::vector<T>&& input) : vector() {
|
||||
m_start = input.m_start;
|
||||
m_finish = input.m_finish;
|
||||
m_reserveEnd = input.m_reserveEnd;
|
||||
|
||||
input.m_start = nullptr;
|
||||
input.m_finish = nullptr;
|
||||
input.m_reserveEnd = nullptr;
|
||||
}
|
||||
|
||||
vector& operator=(gd::vector<T> const& input) {
|
||||
this->clear();
|
||||
|
||||
if (input.size()) {
|
||||
auto capacity = nextCapacity(input.size());
|
||||
m_start = this->allocator().allocate(capacity);
|
||||
m_finish = m_start + input.size();
|
||||
m_reserveEnd = m_start + capacity;
|
||||
|
||||
std::uninitialized_default_construct(m_start, m_finish);
|
||||
std::copy(input.begin(), input.end(), m_start);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
vector& operator=(gd::vector<T>&& input) {
|
||||
m_start = input.m_start;
|
||||
m_finish = input.m_finish;
|
||||
m_reserveEnd = input.m_reserveEnd;
|
||||
|
||||
input.m_start = nullptr;
|
||||
input.m_finish = nullptr;
|
||||
input.m_reserveEnd = nullptr;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void grow() {
|
||||
if (m_finish == m_reserveEnd) {
|
||||
auto newSize = this->capacity() * 2;
|
||||
auto newStart = this->allocator().allocate(newSize);
|
||||
auto newFinish = newStart + this->size();
|
||||
|
||||
std::uninitialized_default_construct(newStart, newFinish);
|
||||
std::copy(m_start, m_finish, newStart);
|
||||
|
||||
std::destroy(m_start, m_finish);
|
||||
this->allocator().deallocate(m_start, this->capacity());
|
||||
|
||||
m_start = newStart;
|
||||
m_finish = newFinish;
|
||||
m_reserveEnd = newStart + newSize;
|
||||
}
|
||||
}
|
||||
|
||||
void shrink() {
|
||||
if (m_finish < m_reserveEnd / 2 && this->capacity() > 16) {
|
||||
auto newSize = this->capacity() / 2;
|
||||
auto newStart = this->allocator().allocate(newSize);
|
||||
auto newFinish = newStart + this->size();
|
||||
|
||||
std::uninitialized_default_construct(newStart, newFinish);
|
||||
std::copy(m_start, m_finish, newStart);
|
||||
|
||||
std::destroy(m_start, m_finish);
|
||||
this->allocator().deallocate(m_start, this->capacity());
|
||||
|
||||
m_start = newStart;
|
||||
m_finish = newFinish;
|
||||
m_reserveEnd = newStart + newSize;
|
||||
}
|
||||
}
|
||||
|
||||
iterator erase(iterator pos)
|
||||
{
|
||||
return erase(pos, pos + 1);
|
||||
}
|
||||
|
||||
iterator erase(const_iterator pos)
|
||||
{
|
||||
return erase(pos, pos + 1);
|
||||
}
|
||||
|
||||
iterator erase(iterator first, iterator last)
|
||||
{
|
||||
std::move(last, m_finish, first);
|
||||
|
||||
--m_finish;
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
iterator erase(const_iterator first, const_iterator last)
|
||||
{
|
||||
std::move(last, m_finish, first);
|
||||
|
||||
--m_finish;
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
void push_back(T const& input) {
|
||||
this->grow();
|
||||
|
||||
new (m_finish) T(input);
|
||||
++m_finish;
|
||||
}
|
||||
|
||||
void push_back(T&& input) {
|
||||
this->grow();
|
||||
|
||||
new (m_finish) T(std::move(input));
|
||||
++m_finish;
|
||||
}
|
||||
|
||||
void pop_back() {
|
||||
if (m_finish != m_start) {
|
||||
--m_finish;
|
||||
m_finish->~T();
|
||||
}
|
||||
|
||||
this->shrink();
|
||||
}
|
||||
|
||||
vector(std::initializer_list<T> const& input) : vector() {
|
||||
if (input.size()) {
|
||||
auto capacity = nextCapacity(input.size());
|
||||
m_start = this->allocator().allocate(capacity);
|
||||
m_finish = m_start + input.size();
|
||||
m_reserveEnd = m_start + capacity;
|
||||
|
||||
std::uninitialized_default_construct(m_start, m_finish);
|
||||
std::copy(input.begin(), input.end(), m_start);
|
||||
}
|
||||
}
|
||||
|
||||
void clear() {
|
||||
if (m_start) {
|
||||
std::destroy(m_start, m_finish);
|
||||
|
||||
this->allocator().deallocate(m_start, this->capacity());
|
||||
}
|
||||
|
||||
m_start = nullptr;
|
||||
m_finish = nullptr;
|
||||
m_reserveEnd = nullptr;
|
||||
}
|
||||
|
||||
T& operator[](size_t index) {
|
||||
return m_start[index];
|
||||
}
|
||||
|
||||
T const& operator[](size_t index) const {
|
||||
return m_start[index];
|
||||
}
|
||||
|
||||
T& at(size_t index) {
|
||||
if (index >= this->size()) {
|
||||
throw std::out_of_range("gd::vector::at");
|
||||
}
|
||||
return m_start[index];
|
||||
}
|
||||
|
||||
T const& at(size_t index) const {
|
||||
if (index >= this->size()) {
|
||||
throw std::out_of_range("gd::vector::at");
|
||||
}
|
||||
return m_start[index];
|
||||
}
|
||||
|
||||
T& front() {
|
||||
return *m_start;
|
||||
}
|
||||
|
||||
T* begin() {
|
||||
return m_start;
|
||||
}
|
||||
|
||||
T* end() {
|
||||
return m_finish;
|
||||
}
|
||||
|
||||
T const* begin() const {
|
||||
return m_start;
|
||||
}
|
||||
|
||||
T const* end() const {
|
||||
return m_finish;
|
||||
}
|
||||
|
||||
~vector() {
|
||||
if (m_start) {
|
||||
for (auto& x : *this) {
|
||||
x.~T();
|
||||
}
|
||||
delete m_start;
|
||||
}
|
||||
}
|
||||
|
||||
size_t size() const {
|
||||
return m_finish - m_start;
|
||||
}
|
||||
|
||||
size_t capacity() const {
|
||||
return m_reserveEnd - m_start;
|
||||
}
|
||||
|
||||
protected:
|
||||
T* m_start;
|
||||
T* m_finish;
|
||||
T* m_reserveEnd;
|
||||
};
|
||||
|
||||
struct _bit_reference {
|
||||
uintptr_t* m_bitptr;
|
||||
uintptr_t m_mask;
|
||||
|
||||
_bit_reference(uintptr_t* x, uintptr_t y) : m_bitptr(x), m_mask(y) {}
|
||||
|
||||
_bit_reference() : m_bitptr(0), m_mask(0) {}
|
||||
|
||||
operator bool() const {
|
||||
return !!(*m_bitptr & m_mask);
|
||||
}
|
||||
|
||||
_bit_reference& operator=(bool x) {
|
||||
if (x) *m_bitptr |= m_mask;
|
||||
else *m_bitptr &= ~m_mask;
|
||||
return *this;
|
||||
}
|
||||
|
||||
_bit_reference& operator=(_bit_reference const& x) {
|
||||
return *this = bool(x);
|
||||
}
|
||||
|
||||
bool operator==(_bit_reference const& x) const {
|
||||
return bool(*this) == bool(x);
|
||||
}
|
||||
|
||||
bool operator<(_bit_reference const& x) const {
|
||||
return !bool(*this) && bool(x);
|
||||
}
|
||||
|
||||
void flip() {
|
||||
*m_bitptr ^= m_mask;
|
||||
}
|
||||
};
|
||||
|
||||
struct _bit_iterator {
|
||||
uintptr_t* m_bitptr;
|
||||
unsigned int m_offset;
|
||||
|
||||
_bit_iterator(uintptr_t* x) : m_bitptr(x), m_offset(0) {}
|
||||
|
||||
_bit_iterator(uintptr_t* x, unsigned o) : m_bitptr(x), m_offset(o) {}
|
||||
|
||||
_bit_reference operator*() const {
|
||||
return _bit_reference(m_bitptr, 1UL << m_offset);
|
||||
}
|
||||
|
||||
_bit_iterator& operator++() {
|
||||
if (m_offset++ == sizeof(uintptr_t) - 1) {
|
||||
m_offset = 0;
|
||||
m_bitptr++;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator!=(_bit_iterator const& b) {
|
||||
return !(m_bitptr == b.m_bitptr && m_offset == b.m_offset);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class vector<bool> {
|
||||
protected:
|
||||
_bit_iterator m_start;
|
||||
_bit_iterator m_end;
|
||||
uintptr_t* m_capacity_end;
|
||||
|
||||
public:
|
||||
auto allocator() const {
|
||||
return gd::allocator<uintptr_t>();
|
||||
}
|
||||
|
||||
vector() : m_start(nullptr), m_end(nullptr), m_capacity_end(nullptr) {}
|
||||
|
||||
// vector(std::vector<bool> input) : vector() {
|
||||
// auto realsize = input.size() / int(sizeof(uintptr_t));
|
||||
// auto start = this->allocator().allocate(realsize);
|
||||
|
||||
// m_start = _bit_iterator(start);
|
||||
// m_end = _bit_iterator(start + realsize, input.size() % sizeof(uintptr_t));
|
||||
// m_capacity_end = start + realsize;
|
||||
|
||||
// auto itmp = m_start;
|
||||
// for (auto i : input) {
|
||||
// *itmp = i;
|
||||
// ++itmp;
|
||||
// }
|
||||
// }
|
||||
|
||||
// vector(vector<bool> const& input) : vector() {
|
||||
|
||||
// }
|
||||
|
||||
// vector() : vector(std::vector<bool>()) {}
|
||||
|
||||
~vector() {
|
||||
delete[] m_start.m_bitptr;
|
||||
}
|
||||
|
||||
operator std::vector<bool>() const {
|
||||
std::vector<bool> out;
|
||||
for (auto i = m_start; i != m_end; ++i) {
|
||||
out.push_back(*i);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
_bit_reference operator[](size_t index) {
|
||||
auto const real_index = index / sizeof(uintptr_t);
|
||||
auto const offset = index % sizeof(uintptr_t);
|
||||
return _bit_reference(&m_start.m_bitptr[real_index], 1UL << offset);
|
||||
}
|
||||
|
||||
bool operator[](size_t index) const {
|
||||
return const_cast<vector&>(*this)[index];
|
||||
}
|
||||
|
||||
_bit_reference at(size_t index) {
|
||||
// TODO: bounds checking
|
||||
return this->operator[](index);
|
||||
}
|
||||
|
||||
bool at(size_t index) const {
|
||||
// TODO: bounds checking
|
||||
return this->operator[](index);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Key, typename Compare = geode::stl::less<Key>, typename Alloc = std::allocator<Key>>
|
||||
using set = geode::stl::set<Key, Compare, Alloc>;
|
||||
|
||||
template <class Key, class Tp, class Hash = geode::stl::hash<Key>, class Pred = geode::stl::equal_to<Key>, class Alloc = std::allocator<std::pair<const Key, Tp>>>
|
||||
using unordered_map = geode::stl::unordered_map<Key, Tp, Hash, Pred, Alloc>;
|
||||
|
||||
template <class Value, class Hash = geode::stl::hash<Value>, class Pred = geode::stl::equal_to<Value>, class Alloc = std::allocator<Value>>
|
||||
using unordered_set = geode::stl::unordered_set<Value, Hash, Pred, Alloc>;
|
||||
};
|
||||
|
||||
#elif defined(GEODE_IS_IOS)
|
||||
namespace gd {
|
||||
class GEODE_DLL string {
|
||||
public:
|
||||
string() {}
|
||||
|
||||
string(char const* ok) : m_internal(ok) {}
|
||||
|
||||
string(std::string ok) : m_internal(ok) {}
|
||||
|
||||
operator std::string() {
|
||||
return m_internal;
|
||||
}
|
||||
|
||||
operator std::string() const {
|
||||
return m_internal;
|
||||
}
|
||||
|
||||
string(string const& ok) : m_internal(ok) {}
|
||||
|
||||
string& operator=(char const* ok) {
|
||||
m_internal = ok;
|
||||
return *this;
|
||||
}
|
||||
|
||||
string& operator=(string const& ok) {
|
||||
m_internal = ok;
|
||||
return *this;
|
||||
}
|
||||
|
||||
~string() {}
|
||||
|
||||
char const* c_str() const {
|
||||
return m_internal.c_str();
|
||||
}
|
||||
|
||||
protected:
|
||||
std::string m_internal;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class GEODE_DLL vector {
|
||||
public:
|
||||
using value_type = T;
|
||||
|
||||
operator std::vector<T>() {
|
||||
return m_internal;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
m_internal.clear();
|
||||
}
|
||||
|
||||
operator std::vector<T>() const {
|
||||
return m_internal;
|
||||
}
|
||||
|
||||
vector(std::vector<T> input) : m_internal(input) {}
|
||||
|
||||
T& front() {
|
||||
return m_internal.front();
|
||||
}
|
||||
|
||||
vector(vector const& lol) : m_internal(lol) {}
|
||||
|
||||
vector() : m_internal() {}
|
||||
|
||||
~vector() {}
|
||||
|
||||
protected:
|
||||
std::vector<T> m_internal;
|
||||
};
|
||||
|
||||
template <typename K, typename V>
|
||||
class GEODE_DLL map {
|
||||
protected:
|
||||
std::map<K, V> m_internal;
|
||||
|
||||
public:
|
||||
operator std::map<K, V>() {
|
||||
return m_internal;
|
||||
}
|
||||
|
||||
operator std::map<K, V>() const {
|
||||
return m_internal;
|
||||
}
|
||||
|
||||
map(std::map<K, V> input) : m_internal(input) {}
|
||||
|
||||
map(map const& lol) : m_internal(lol) {}
|
||||
|
||||
map() {}
|
||||
|
||||
~map() {}
|
||||
};
|
||||
}
|
||||
#endif
|
|
@ -1,531 +0,0 @@
|
|||
// Allocator traits -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2011-2014 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/alloc_traits.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{memory}
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
|
||||
#include "memoryfwd.h"
|
||||
#include "ptr_traits.h"
|
||||
#include "type_traits.h"
|
||||
#include "ext/numeric_traits.h"
|
||||
|
||||
namespace geode::stl {
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
template<typename _Alloc, typename _Tp>
|
||||
class __alloctr_rebind_helper
|
||||
{
|
||||
template<typename _Alloc2, typename _Tp2>
|
||||
static constexpr std::true_type
|
||||
_S_chk(typename _Alloc2::template rebind<_Tp2>::other*);
|
||||
|
||||
template<typename, typename>
|
||||
static constexpr std::false_type
|
||||
_S_chk(...);
|
||||
|
||||
public:
|
||||
using __type = decltype(_S_chk<_Alloc, _Tp>(nullptr));
|
||||
};
|
||||
|
||||
template<typename _Alloc, typename _Tp,
|
||||
bool = __alloctr_rebind_helper<_Alloc, _Tp>::__type::value>
|
||||
struct __alloctr_rebind;
|
||||
|
||||
template<typename _Alloc, typename _Tp>
|
||||
struct __alloctr_rebind<_Alloc, _Tp, true>
|
||||
{
|
||||
typedef typename _Alloc::template rebind<_Tp>::other __type;
|
||||
};
|
||||
|
||||
template<template<typename, typename...> class _Alloc, typename _Tp,
|
||||
typename _Up, typename... _Args>
|
||||
struct __alloctr_rebind<_Alloc<_Up, _Args...>, _Tp, false>
|
||||
{
|
||||
typedef _Alloc<_Tp, _Args...> __type;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Uniform interface to all allocator types.
|
||||
* @ingroup allocators
|
||||
*/
|
||||
template<typename _Alloc>
|
||||
struct allocator_traits
|
||||
{
|
||||
/// The allocator type
|
||||
typedef _Alloc allocator_type;
|
||||
/// The allocated type
|
||||
typedef typename _Alloc::value_type value_type;
|
||||
|
||||
#define _GLIBCXX_ALLOC_TR_NESTED_TYPE(_NTYPE, _ALT) \
|
||||
private: \
|
||||
template<typename _Tp> \
|
||||
static typename _Tp::_NTYPE _S_##_NTYPE##_helper(_Tp*); \
|
||||
static _ALT _S_##_NTYPE##_helper(...); \
|
||||
typedef decltype(_S_##_NTYPE##_helper((_Alloc*)0)) __##_NTYPE; \
|
||||
public:
|
||||
|
||||
_GLIBCXX_ALLOC_TR_NESTED_TYPE(pointer, value_type*)
|
||||
|
||||
/**
|
||||
* @brief The allocator's pointer type.
|
||||
*
|
||||
* @c Alloc::pointer if that type exists, otherwise @c value_type*
|
||||
*/
|
||||
typedef __pointer pointer;
|
||||
|
||||
_GLIBCXX_ALLOC_TR_NESTED_TYPE(const_pointer,
|
||||
typename pointer_traits<pointer>::template rebind<const value_type>)
|
||||
|
||||
/**
|
||||
* @brief The allocator's const pointer type.
|
||||
*
|
||||
* @c Alloc::const_pointer if that type exists, otherwise
|
||||
* <tt> pointer_traits<pointer>::rebind<const value_type> </tt>
|
||||
*/
|
||||
typedef __const_pointer const_pointer;
|
||||
|
||||
_GLIBCXX_ALLOC_TR_NESTED_TYPE(void_pointer,
|
||||
typename pointer_traits<pointer>::template rebind<void>)
|
||||
|
||||
/**
|
||||
* @brief The allocator's void pointer type.
|
||||
*
|
||||
* @c Alloc::void_pointer if that type exists, otherwise
|
||||
* <tt> pointer_traits<pointer>::rebind<void> </tt>
|
||||
*/
|
||||
typedef __void_pointer void_pointer;
|
||||
|
||||
_GLIBCXX_ALLOC_TR_NESTED_TYPE(const_void_pointer,
|
||||
typename pointer_traits<pointer>::template rebind<const void>)
|
||||
|
||||
/**
|
||||
* @brief The allocator's const void pointer type.
|
||||
*
|
||||
* @c Alloc::const_void_pointer if that type exists, otherwise
|
||||
* <tt> pointer_traits<pointer>::rebind<const void> </tt>
|
||||
*/
|
||||
typedef __const_void_pointer const_void_pointer;
|
||||
|
||||
_GLIBCXX_ALLOC_TR_NESTED_TYPE(difference_type,
|
||||
typename pointer_traits<pointer>::difference_type)
|
||||
|
||||
/**
|
||||
* @brief The allocator's difference type
|
||||
*
|
||||
* @c Alloc::difference_type if that type exists, otherwise
|
||||
* <tt> pointer_traits<pointer>::difference_type </tt>
|
||||
*/
|
||||
typedef __difference_type difference_type;
|
||||
|
||||
_GLIBCXX_ALLOC_TR_NESTED_TYPE(size_type,
|
||||
typename std::make_unsigned<difference_type>::type)
|
||||
|
||||
/**
|
||||
* @brief The allocator's size type
|
||||
*
|
||||
* @c Alloc::size_type if that type exists, otherwise
|
||||
* <tt> make_unsigned<difference_type>::type </tt>
|
||||
*/
|
||||
typedef __size_type size_type;
|
||||
|
||||
_GLIBCXX_ALLOC_TR_NESTED_TYPE(propagate_on_container_copy_assignment,
|
||||
std::false_type)
|
||||
|
||||
/**
|
||||
* @brief How the allocator is propagated on copy assignment
|
||||
*
|
||||
* @c Alloc::propagate_on_container_copy_assignment if that type exists,
|
||||
* otherwise @c false_type
|
||||
*/
|
||||
typedef __propagate_on_container_copy_assignment
|
||||
propagate_on_container_copy_assignment;
|
||||
|
||||
_GLIBCXX_ALLOC_TR_NESTED_TYPE(propagate_on_container_move_assignment,
|
||||
std::false_type)
|
||||
|
||||
/**
|
||||
* @brief How the allocator is propagated on move assignment
|
||||
*
|
||||
* @c Alloc::propagate_on_container_move_assignment if that type exists,
|
||||
* otherwise @c false_type
|
||||
*/
|
||||
typedef __propagate_on_container_move_assignment
|
||||
propagate_on_container_move_assignment;
|
||||
|
||||
_GLIBCXX_ALLOC_TR_NESTED_TYPE(propagate_on_container_swap,
|
||||
std::false_type)
|
||||
|
||||
/**
|
||||
* @brief How the allocator is propagated on swap
|
||||
*
|
||||
* @c Alloc::propagate_on_container_swap if that type exists,
|
||||
* otherwise @c false_type
|
||||
*/
|
||||
typedef __propagate_on_container_swap propagate_on_container_swap;
|
||||
|
||||
#undef _GLIBCXX_ALLOC_TR_NESTED_TYPE
|
||||
|
||||
template<typename _Tp>
|
||||
using rebind_alloc = typename __alloctr_rebind<_Alloc, _Tp>::__type;
|
||||
template<typename _Tp>
|
||||
using rebind_traits = allocator_traits<rebind_alloc<_Tp>>;
|
||||
|
||||
private:
|
||||
template<typename _Alloc2>
|
||||
struct __allocate_helper
|
||||
{
|
||||
template<typename _Alloc3,
|
||||
typename = decltype(std::declval<_Alloc3*>()->allocate(
|
||||
std::declval<size_type>(),
|
||||
std::declval<const_void_pointer>()))>
|
||||
static std::true_type __test(int);
|
||||
|
||||
template<typename>
|
||||
static std::false_type __test(...);
|
||||
|
||||
using type = decltype(__test<_Alloc>(0));
|
||||
};
|
||||
|
||||
template<typename _Alloc2>
|
||||
using __has_allocate = typename __allocate_helper<_Alloc2>::type;
|
||||
|
||||
template<typename _Alloc2,
|
||||
typename = _Require<__has_allocate<_Alloc2>>>
|
||||
static pointer
|
||||
_S_allocate(_Alloc2& __a, size_type __n, const_void_pointer __hint)
|
||||
{ return __a.allocate(__n, __hint); }
|
||||
|
||||
template<typename _Alloc2, typename _UnusedHint,
|
||||
typename = _Require<__not_<__has_allocate<_Alloc2>>>>
|
||||
static pointer
|
||||
_S_allocate(_Alloc2& __a, size_type __n, _UnusedHint)
|
||||
{ return __a.allocate(__n); }
|
||||
|
||||
template<typename _Tp, typename... _Args>
|
||||
struct __construct_helper
|
||||
{
|
||||
template<typename _Alloc2,
|
||||
typename = decltype(std::declval<_Alloc2*>()->construct(
|
||||
std::declval<_Tp*>(), std::declval<_Args>()...))>
|
||||
static std::true_type __test(int);
|
||||
|
||||
template<typename>
|
||||
static std::false_type __test(...);
|
||||
|
||||
using type = decltype(__test<_Alloc>(0));
|
||||
};
|
||||
|
||||
template<typename _Tp, typename... _Args>
|
||||
using __has_construct
|
||||
= typename __construct_helper<_Tp, _Args...>::type;
|
||||
|
||||
template<typename _Tp, typename... _Args>
|
||||
static _Require<__has_construct<_Tp, _Args...>>
|
||||
_S_construct(_Alloc& __a, _Tp* __p, _Args&&... __args)
|
||||
{ __a.construct(__p, std::forward<_Args>(__args)...); }
|
||||
|
||||
template<typename _Tp, typename... _Args>
|
||||
static
|
||||
_Require<std::conjunction<__not_<__has_construct<_Tp, _Args...>>,
|
||||
std::is_constructible<_Tp, _Args...>>>
|
||||
_S_construct(_Alloc&, _Tp* __p, _Args&&... __args)
|
||||
{ ::new((void*)__p) _Tp(std::forward<_Args>(__args)...); }
|
||||
|
||||
template<typename _Tp>
|
||||
struct __destroy_helper
|
||||
{
|
||||
template<typename _Alloc2,
|
||||
typename = decltype(std::declval<_Alloc2*>()->destroy(
|
||||
std::declval<_Tp*>()))>
|
||||
static std::true_type __test(int);
|
||||
|
||||
template<typename>
|
||||
static std::false_type __test(...);
|
||||
|
||||
using type = decltype(__test<_Alloc>(0));
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
using __has_destroy = typename __destroy_helper<_Tp>::type;
|
||||
|
||||
template<typename _Tp>
|
||||
static _Require<__has_destroy<_Tp>>
|
||||
_S_destroy(_Alloc& __a, _Tp* __p)
|
||||
{ __a.destroy(__p); }
|
||||
|
||||
template<typename _Tp>
|
||||
static _Require<__not_<__has_destroy<_Tp>>>
|
||||
_S_destroy(_Alloc&, _Tp* __p)
|
||||
{ __p->~_Tp(); }
|
||||
|
||||
template<typename _Alloc2>
|
||||
struct __maxsize_helper
|
||||
{
|
||||
template<typename _Alloc3,
|
||||
typename = decltype(std::declval<_Alloc3*>()->max_size())>
|
||||
static std::true_type __test(int);
|
||||
|
||||
template<typename>
|
||||
static std::false_type __test(...);
|
||||
|
||||
using type = decltype(__test<_Alloc2>(0));
|
||||
};
|
||||
|
||||
template<typename _Alloc2>
|
||||
using __has_max_size = typename __maxsize_helper<_Alloc2>::type;
|
||||
|
||||
template<typename _Alloc2,
|
||||
typename = _Require<__has_max_size<_Alloc2>>>
|
||||
static size_type
|
||||
_S_max_size(_Alloc2& __a, int)
|
||||
{ return __a.max_size(); }
|
||||
|
||||
template<typename _Alloc2,
|
||||
typename = _Require<__not_<__has_max_size<_Alloc2>>>>
|
||||
static size_type
|
||||
_S_max_size(_Alloc2&, ...)
|
||||
{ return __gnu_cxx::__numeric_traits<size_type>::__max; }
|
||||
|
||||
template<typename _Alloc2>
|
||||
struct __select_helper
|
||||
{
|
||||
template<typename _Alloc3, typename
|
||||
= decltype(std::declval<_Alloc3*>()
|
||||
->select_on_container_copy_construction())>
|
||||
static std::true_type __test(int);
|
||||
|
||||
template<typename>
|
||||
static std::false_type __test(...);
|
||||
|
||||
using type = decltype(__test<_Alloc2>(0));
|
||||
};
|
||||
|
||||
template<typename _Alloc2>
|
||||
using __has_soccc = typename __select_helper<_Alloc2>::type;
|
||||
|
||||
template<typename _Alloc2,
|
||||
typename = _Require<__has_soccc<_Alloc2>>>
|
||||
static _Alloc2
|
||||
_S_select(_Alloc2& __a, int)
|
||||
{ return __a.select_on_container_copy_construction(); }
|
||||
|
||||
template<typename _Alloc2,
|
||||
typename = _Require<__not_<__has_soccc<_Alloc2>>>>
|
||||
static _Alloc2
|
||||
_S_select(_Alloc2& __a, ...)
|
||||
{ return __a; }
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Allocate memory.
|
||||
* @param __a An allocator.
|
||||
* @param __n The number of objects to allocate space for.
|
||||
*
|
||||
* Calls @c a.allocate(n)
|
||||
*/
|
||||
static pointer
|
||||
allocate(_Alloc& __a, size_type __n)
|
||||
{ return __a.allocate(__n); }
|
||||
|
||||
/**
|
||||
* @brief Allocate memory.
|
||||
* @param __a An allocator.
|
||||
* @param __n The number of objects to allocate space for.
|
||||
* @param __hint Aid to locality.
|
||||
* @return Memory of suitable size and alignment for @a n objects
|
||||
* of type @c value_type
|
||||
*
|
||||
* Returns <tt> a.allocate(n, hint) </tt> if that expression is
|
||||
* well-formed, otherwise returns @c a.allocate(n)
|
||||
*/
|
||||
static pointer
|
||||
allocate(_Alloc& __a, size_type __n, const_void_pointer __hint)
|
||||
{ return _S_allocate(__a, __n, __hint); }
|
||||
|
||||
/**
|
||||
* @brief Deallocate memory.
|
||||
* @param __a An allocator.
|
||||
* @param __p Pointer to the memory to deallocate.
|
||||
* @param __n The number of objects space was allocated for.
|
||||
*
|
||||
* Calls <tt> a.deallocate(p, n) </tt>
|
||||
*/
|
||||
static void deallocate(_Alloc& __a, pointer __p, size_type __n)
|
||||
{ __a.deallocate(__p, __n); }
|
||||
|
||||
/**
|
||||
* @brief Construct an object of type @a _Tp
|
||||
* @param __a An allocator.
|
||||
* @param __p Pointer to memory of suitable size and alignment for Tp
|
||||
* @param __args Constructor arguments.
|
||||
*
|
||||
* Calls <tt> __a.construct(__p, std::forward<Args>(__args)...) </tt>
|
||||
* if that expression is well-formed, otherwise uses placement-new
|
||||
* to construct an object of type @a _Tp at location @a __p from the
|
||||
* arguments @a __args...
|
||||
*/
|
||||
template<typename _Tp, typename... _Args>
|
||||
static auto construct(_Alloc& __a, _Tp* __p, _Args&&... __args)
|
||||
-> decltype(_S_construct(__a, __p, std::forward<_Args>(__args)...))
|
||||
{ _S_construct(__a, __p, std::forward<_Args>(__args)...); }
|
||||
|
||||
/**
|
||||
* @brief Destroy an object of type @a _Tp
|
||||
* @param __a An allocator.
|
||||
* @param __p Pointer to the object to destroy
|
||||
*
|
||||
* Calls @c __a.destroy(__p) if that expression is well-formed,
|
||||
* otherwise calls @c __p->~_Tp()
|
||||
*/
|
||||
template <class _Tp>
|
||||
static void destroy(_Alloc& __a, _Tp* __p)
|
||||
{ _S_destroy(__a, __p); }
|
||||
|
||||
/**
|
||||
* @brief The maximum supported allocation size
|
||||
* @param __a An allocator.
|
||||
* @return @c __a.max_size() or @c numeric_limits<size_type>::max()
|
||||
*
|
||||
* Returns @c __a.max_size() if that expression is well-formed,
|
||||
* otherwise returns @c numeric_limits<size_type>::max()
|
||||
*/
|
||||
static size_type max_size(const _Alloc& __a) noexcept
|
||||
{ return _S_max_size(__a, 0); }
|
||||
|
||||
/**
|
||||
* @brief Obtain an allocator to use when copying a container.
|
||||
* @param __rhs An allocator.
|
||||
* @return @c __rhs.select_on_container_copy_construction() or @a __rhs
|
||||
*
|
||||
* Returns @c __rhs.select_on_container_copy_construction() if that
|
||||
* expression is well-formed, otherwise returns @a __rhs
|
||||
*/
|
||||
static _Alloc
|
||||
select_on_container_copy_construction(const _Alloc& __rhs)
|
||||
{ return _S_select(__rhs, 0); }
|
||||
};
|
||||
|
||||
template<typename _Alloc>
|
||||
inline void
|
||||
__do_alloc_on_copy(_Alloc& __one, const _Alloc& __two, std::true_type)
|
||||
{ __one = __two; }
|
||||
|
||||
template<typename _Alloc>
|
||||
inline void
|
||||
__do_alloc_on_copy(_Alloc&, const _Alloc&, std::false_type)
|
||||
{ }
|
||||
|
||||
template<typename _Alloc>
|
||||
inline void __alloc_on_copy(_Alloc& __one, const _Alloc& __two)
|
||||
{
|
||||
typedef allocator_traits<_Alloc> __traits;
|
||||
typedef typename __traits::propagate_on_container_copy_assignment __pocca;
|
||||
__do_alloc_on_copy(__one, __two, __pocca());
|
||||
}
|
||||
|
||||
template<typename _Alloc>
|
||||
inline _Alloc __alloc_on_copy(const _Alloc& __a)
|
||||
{
|
||||
typedef allocator_traits<_Alloc> __traits;
|
||||
return __traits::select_on_container_copy_construction(__a);
|
||||
}
|
||||
|
||||
template<typename _Alloc>
|
||||
inline void __do_alloc_on_move(_Alloc& __one, _Alloc& __two, std::true_type)
|
||||
{ __one = std::move(__two); }
|
||||
|
||||
template<typename _Alloc>
|
||||
inline void __do_alloc_on_move(_Alloc&, _Alloc&, std::false_type)
|
||||
{ }
|
||||
|
||||
template<typename _Alloc>
|
||||
inline void __alloc_on_move(_Alloc& __one, _Alloc& __two)
|
||||
{
|
||||
typedef allocator_traits<_Alloc> __traits;
|
||||
typedef typename __traits::propagate_on_container_move_assignment __pocma;
|
||||
__do_alloc_on_move(__one, __two, __pocma());
|
||||
}
|
||||
|
||||
template<typename _Alloc>
|
||||
inline void __do_alloc_on_swap(_Alloc& __one, _Alloc& __two, std::true_type)
|
||||
{
|
||||
using std::swap;
|
||||
swap(__one, __two);
|
||||
}
|
||||
|
||||
template<typename _Alloc>
|
||||
inline void __do_alloc_on_swap(_Alloc&, _Alloc&, std::false_type)
|
||||
{ }
|
||||
|
||||
template<typename _Alloc>
|
||||
inline void __alloc_on_swap(_Alloc& __one, _Alloc& __two)
|
||||
{
|
||||
typedef allocator_traits<_Alloc> __traits;
|
||||
typedef typename __traits::propagate_on_container_swap __pocs;
|
||||
__do_alloc_on_swap(__one, __two, __pocs());
|
||||
}
|
||||
|
||||
template<typename _Alloc>
|
||||
class __is_copy_insertable_impl
|
||||
{
|
||||
typedef allocator_traits<_Alloc> _Traits;
|
||||
|
||||
template<typename _Up, typename
|
||||
= decltype(_Traits::construct(std::declval<_Alloc&>(),
|
||||
std::declval<_Up*>(),
|
||||
std::declval<const _Up&>()))>
|
||||
static std::true_type
|
||||
_M_select(int);
|
||||
|
||||
template<typename _Up>
|
||||
static std::false_type
|
||||
_M_select(...);
|
||||
|
||||
public:
|
||||
typedef decltype(_M_select<typename _Alloc::value_type>(0)) type;
|
||||
};
|
||||
|
||||
// true if _Alloc::value_type is CopyInsertable into containers using _Alloc
|
||||
template<typename _Alloc>
|
||||
struct __is_copy_insertable
|
||||
: __is_copy_insertable_impl<_Alloc>::type
|
||||
{ };
|
||||
|
||||
// std::allocator<_Tp> just requires CopyConstructible
|
||||
template<typename _Tp>
|
||||
struct __is_copy_insertable<allocator<_Tp>>
|
||||
: std::is_copy_constructible<_Tp>
|
||||
{ };
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace std
|
||||
|
||||
#endif
|
|
@ -1,220 +0,0 @@
|
|||
// Allocators -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-1997
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*/
|
||||
|
||||
/** @file bits/allocator.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{memory}
|
||||
*/
|
||||
|
||||
#ifndef _ALLOCATOR_H
|
||||
#define _ALLOCATOR_H 1
|
||||
|
||||
#include "c++allocator.hpp" // Define the base class to std::allocator.
|
||||
#include "memoryfwd.h"
|
||||
#if __cplusplus >= 201103L
|
||||
#include <type_traits>
|
||||
#endif
|
||||
|
||||
namespace geode::stl {
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
/**
|
||||
* @addtogroup allocators
|
||||
* @{
|
||||
*/
|
||||
|
||||
/// allocator<void> specialization.
|
||||
template<>
|
||||
class allocator<void>
|
||||
{
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef void* pointer;
|
||||
typedef const void* const_pointer;
|
||||
typedef void value_type;
|
||||
|
||||
template<typename _Tp1>
|
||||
struct rebind
|
||||
{ typedef allocator<_Tp1> other; };
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 2103. std::allocator propagate_on_container_move_assignment
|
||||
typedef std::true_type propagate_on_container_move_assignment;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The @a standard allocator, as per [20.4].
|
||||
*
|
||||
* See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt04ch11.html
|
||||
* for further details.
|
||||
*
|
||||
* @tparam _Tp Type of allocated object.
|
||||
*/
|
||||
template<typename _Tp>
|
||||
class allocator: public __allocator_base<_Tp>
|
||||
{
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef _Tp* pointer;
|
||||
typedef const _Tp* const_pointer;
|
||||
typedef _Tp& reference;
|
||||
typedef const _Tp& const_reference;
|
||||
typedef _Tp value_type;
|
||||
|
||||
template<typename _Tp1>
|
||||
struct rebind
|
||||
{ typedef allocator<_Tp1> other; };
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 2103. std::allocator propagate_on_container_move_assignment
|
||||
typedef std::true_type propagate_on_container_move_assignment;
|
||||
#endif
|
||||
|
||||
allocator() throw() { }
|
||||
|
||||
allocator(const allocator& __a) throw()
|
||||
: __allocator_base<_Tp>(__a) { }
|
||||
|
||||
template<typename _Tp1>
|
||||
allocator(const allocator<_Tp1>&) throw() { }
|
||||
|
||||
~allocator() throw() { }
|
||||
|
||||
// Inherit everything else.
|
||||
};
|
||||
|
||||
template<typename _T1, typename _T2>
|
||||
inline bool
|
||||
operator==(const allocator<_T1>&, const allocator<_T2>&)
|
||||
{ return true; }
|
||||
|
||||
template<typename _Tp>
|
||||
inline bool
|
||||
operator==(const allocator<_Tp>&, const allocator<_Tp>&)
|
||||
{ return true; }
|
||||
|
||||
template<typename _T1, typename _T2>
|
||||
inline bool
|
||||
operator!=(const allocator<_T1>&, const allocator<_T2>&)
|
||||
{ return false; }
|
||||
|
||||
template<typename _Tp>
|
||||
inline bool
|
||||
operator!=(const allocator<_Tp>&, const allocator<_Tp>&)
|
||||
{ return false; }
|
||||
|
||||
/// @} group allocator
|
||||
|
||||
// Inhibit implicit instantiations for required instantiations,
|
||||
// which are defined via explicit instantiations elsewhere.
|
||||
#if _GLIBCXX_EXTERN_TEMPLATE
|
||||
extern template class allocator<char>;
|
||||
extern template class allocator<wchar_t>;
|
||||
#endif
|
||||
|
||||
// Undefine.
|
||||
#undef __allocator_base
|
||||
|
||||
// To implement Option 3 of DR 431.
|
||||
template<typename _Alloc, bool = __is_empty(_Alloc)>
|
||||
struct __alloc_swap
|
||||
{ static void _S_do_it(_Alloc&, _Alloc&) _GLIBCXX_NOEXCEPT { } };
|
||||
|
||||
template<typename _Alloc>
|
||||
struct __alloc_swap<_Alloc, false>
|
||||
{
|
||||
static void
|
||||
_S_do_it(_Alloc& __one, _Alloc& __two) _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
// Precondition: swappable allocators.
|
||||
if (__one != __two)
|
||||
swap(__one, __two);
|
||||
}
|
||||
};
|
||||
|
||||
// Optimize for stateless allocators.
|
||||
template<typename _Alloc, bool = __is_empty(_Alloc)>
|
||||
struct __alloc_neq
|
||||
{
|
||||
static bool
|
||||
_S_do_it(const _Alloc&, const _Alloc&)
|
||||
{ return false; }
|
||||
};
|
||||
|
||||
template<typename _Alloc>
|
||||
struct __alloc_neq<_Alloc, false>
|
||||
{
|
||||
static bool
|
||||
_S_do_it(const _Alloc& __one, const _Alloc& __two)
|
||||
{ return __one != __two; }
|
||||
};
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _Tp, bool
|
||||
= std::disjunction<std::is_copy_constructible<typename _Tp::value_type>,
|
||||
std::is_nothrow_move_constructible<typename _Tp::value_type>>::value>
|
||||
struct __shrink_to_fit_aux
|
||||
{ static bool _S_do_it(_Tp&) noexcept { return false; } };
|
||||
|
||||
template<typename _Tp>
|
||||
struct __shrink_to_fit_aux<_Tp, true>
|
||||
{
|
||||
static bool
|
||||
_S_do_it(_Tp& __c) noexcept
|
||||
{
|
||||
try
|
||||
{
|
||||
_Tp(__make_move_if_noexcept_iterator(__c.begin()),
|
||||
__make_move_if_noexcept_iterator(__c.end()),
|
||||
__c.get_allocator()).swap(__c);
|
||||
return true;
|
||||
}
|
||||
catch(...)
|
||||
{ return false; }
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace std
|
||||
|
||||
#endif
|
|
@ -1,54 +0,0 @@
|
|||
// Base to std::allocator -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2004-2014 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/c++allocator.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{memory}
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_CXX_ALLOCATOR_H
|
||||
#define _GLIBCXX_CXX_ALLOCATOR_H 1
|
||||
|
||||
#include "ext/new_allocator.h"
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
namespace geode::stl {
|
||||
/**
|
||||
* @brief An alias to the base class for std::allocator.
|
||||
* @ingroup allocators
|
||||
*
|
||||
* Used to set the std::allocator base class to
|
||||
* __gnu_cxx::new_allocator.
|
||||
*
|
||||
* @tparam _Tp Type of allocated object.
|
||||
*/
|
||||
template<typename _Tp>
|
||||
using __allocator_base = __gnu_cxx::new_allocator<_Tp>;
|
||||
}
|
||||
#else
|
||||
// Define new_allocator as the base class to std::allocator.
|
||||
# define __allocator_base __gnu_cxx::new_allocator
|
||||
#endif
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,21 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#if UINTPTR_MAX > 0xffffffff
|
||||
# include "c++config-arm64.h"
|
||||
#else
|
||||
# include "c++config-armeabi-v7a.h"
|
||||
#endif
|
||||
|
||||
#define _GLIBCXX_NODISCARD __attribute__ ((__warn_unused_result__))
|
||||
#define _GLIBCXX20_CONSTEXPR constexpr
|
||||
#define _GLIBCXX17_CONSTEXPR constexpr
|
||||
#define _GLIBCXX_NOEXCEPT_IF(...) noexcept(__VA_ARGS__)
|
||||
|
||||
// i put this here cuz it's used all over the place
|
||||
namespace geode::stl {
|
||||
template <typename T> using __not_ = std::integral_constant<bool, !T::value>;
|
||||
template <typename... T> using __or_ = std::disjunction<T...>;
|
||||
template <typename... T> using __and_ = std::conjunction<T...>;
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
// Concept-checking control -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/concept_check.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{iterator}
|
||||
*/
|
||||
|
||||
#ifndef _CONCEPT_CHECK_H
|
||||
#define _CONCEPT_CHECK_H 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include "c++config.h"
|
||||
|
||||
// All places in libstdc++-v3 where these are used, or /might/ be used, or
|
||||
// don't need to be used, or perhaps /should/ be used, are commented with
|
||||
// "concept requirements" (and maybe some more text). So grep like crazy
|
||||
// if you're looking for additional places to use these.
|
||||
|
||||
// Concept-checking code is off by default unless users turn it on via
|
||||
// configure options or editing c++config.h.
|
||||
|
||||
#ifndef _GLIBCXX_CONCEPT_CHECKS
|
||||
|
||||
#define __glibcxx_function_requires(...)
|
||||
#define __glibcxx_class_requires(_a,_b)
|
||||
#define __glibcxx_class_requires2(_a,_b,_c)
|
||||
#define __glibcxx_class_requires3(_a,_b,_c,_d)
|
||||
#define __glibcxx_class_requires4(_a,_b,_c,_d,_e)
|
||||
|
||||
#else // the checks are on
|
||||
|
||||
#include "boost_concept_check.h"
|
||||
|
||||
// Note that the obvious and elegant approach of
|
||||
//
|
||||
//#define glibcxx_function_requires(C) debug::function_requires< debug::C >()
|
||||
//
|
||||
// won't work due to concept templates with more than one parameter, e.g.,
|
||||
// BinaryPredicateConcept. The preprocessor tries to split things up on
|
||||
// the commas in the template argument list. We can't use an inner pair of
|
||||
// parenthesis to hide the commas, because "debug::(Temp<Foo,Bar>)" isn't
|
||||
// a valid instantiation pattern. Thus, we steal a feature from C99.
|
||||
|
||||
#define __glibcxx_function_requires(...) \
|
||||
__gnu_cxx::__function_requires< __gnu_cxx::__VA_ARGS__ >();
|
||||
#define __glibcxx_class_requires(_a,_C) \
|
||||
_GLIBCXX_CLASS_REQUIRES(_a, __gnu_cxx, _C);
|
||||
#define __glibcxx_class_requires2(_a,_b,_C) \
|
||||
_GLIBCXX_CLASS_REQUIRES2(_a, _b, __gnu_cxx, _C);
|
||||
#define __glibcxx_class_requires3(_a,_b,_c,_C) \
|
||||
_GLIBCXX_CLASS_REQUIRES3(_a, _b, _c, __gnu_cxx, _C);
|
||||
#define __glibcxx_class_requires4(_a,_b,_c,_d,_C) \
|
||||
_GLIBCXX_CLASS_REQUIRES4(_a, _b, _c, _d, __gnu_cxx, _C);
|
||||
|
||||
#endif // enable/disable
|
||||
|
||||
#endif // _GLIBCXX_CONCEPT_CHECK
|
|
@ -1,421 +0,0 @@
|
|||
// The -*- C++ -*- type traits classes for internal use in libstdc++
|
||||
|
||||
// Copyright (C) 2000-2014 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/cpp_type_traits.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{ext/type_traits}
|
||||
*/
|
||||
|
||||
// Written by Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
|
||||
|
||||
#ifndef _CPP_TYPE_TRAITS_H
|
||||
#define _CPP_TYPE_TRAITS_H 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include "c++config.h"
|
||||
|
||||
//
|
||||
// This file provides some compile-time information about various types.
|
||||
// These representations were designed, on purpose, to be constant-expressions
|
||||
// and not types as found in <bits/type_traits.h>. In particular, they
|
||||
// can be used in control structures and the optimizer hopefully will do
|
||||
// the obvious thing.
|
||||
//
|
||||
// Why integral expressions, and not functions nor types?
|
||||
// Firstly, these compile-time entities are used as template-arguments
|
||||
// so function return values won't work: We need compile-time entities.
|
||||
// We're left with types and constant integral expressions.
|
||||
// Secondly, from the point of view of ease of use, type-based compile-time
|
||||
// information is -not- *that* convenient. On has to write lots of
|
||||
// overloaded functions and to hope that the compiler will select the right
|
||||
// one. As a net effect, the overall structure isn't very clear at first
|
||||
// glance.
|
||||
// Thirdly, partial ordering and overload resolution (of function templates)
|
||||
// is highly costly in terms of compiler-resource. It is a Good Thing to
|
||||
// keep these resource consumption as least as possible.
|
||||
//
|
||||
// See valarray_array.h for a case use.
|
||||
//
|
||||
// -- Gaby (dosreis@cmla.ens-cachan.fr) 2000-03-06.
|
||||
//
|
||||
// Update 2005: types are also provided and <bits/type_traits.h> has been
|
||||
// removed.
|
||||
//
|
||||
|
||||
// Forward declaration hack, should really include this from somewhere.
|
||||
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
template<typename _Iterator, typename _Container>
|
||||
class __normal_iterator;
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
||||
|
||||
namespace geode::stl {
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
struct __true_type { };
|
||||
struct __false_type { };
|
||||
|
||||
template<bool>
|
||||
struct __truth_type
|
||||
{ typedef __false_type __type; };
|
||||
|
||||
template<>
|
||||
struct __truth_type<true>
|
||||
{ typedef __true_type __type; };
|
||||
|
||||
// N.B. The conversions to bool are needed due to the issue
|
||||
// explained in c++/19404.
|
||||
template<class _Sp, class _Tp>
|
||||
struct __traitor
|
||||
{
|
||||
enum { __value = bool(_Sp::__value) || bool(_Tp::__value) };
|
||||
typedef typename __truth_type<__value>::__type __type;
|
||||
};
|
||||
|
||||
// Compare for equality of types.
|
||||
template<typename, typename>
|
||||
struct __are_same
|
||||
{
|
||||
enum { __value = 0 };
|
||||
typedef __false_type __type;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct __are_same<_Tp, _Tp>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
/*
|
||||
// Holds if the template-argument is a void type.
|
||||
template<typename _Tp>
|
||||
struct __is_void
|
||||
{
|
||||
enum { __value = 0 };
|
||||
typedef __false_type __type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_void<void>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
*/
|
||||
|
||||
//
|
||||
// Integer types
|
||||
//
|
||||
template<typename _Tp>
|
||||
struct __is_integer
|
||||
{
|
||||
enum { __value = 0 };
|
||||
typedef __false_type __type;
|
||||
};
|
||||
|
||||
// Thirteen specializations (yes there are eleven standard integer
|
||||
// types; <em>long long</em> and <em>unsigned long long</em> are
|
||||
// supported as extensions)
|
||||
template<>
|
||||
struct __is_integer<bool>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_integer<char>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_integer<signed char>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_integer<unsigned char>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
# ifdef _GLIBCXX_USE_WCHAR_T
|
||||
template<>
|
||||
struct __is_integer<wchar_t>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
# endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<>
|
||||
struct __is_integer<char16_t>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_integer<char32_t>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
#endif
|
||||
|
||||
template<>
|
||||
struct __is_integer<short>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_integer<unsigned short>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_integer<int>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_integer<unsigned int>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_integer<long>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_integer<unsigned long>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_integer<long long>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_integer<unsigned long long>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
//
|
||||
// Floating point types
|
||||
//
|
||||
template<typename _Tp>
|
||||
struct __is_floating
|
||||
{
|
||||
enum { __value = 0 };
|
||||
typedef __false_type __type;
|
||||
};
|
||||
|
||||
// three specializations (float, double and 'long double')
|
||||
template<>
|
||||
struct __is_floating<float>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_floating<double>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_floating<long double>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
/*
|
||||
//
|
||||
// Pointer types
|
||||
//
|
||||
template<typename _Tp>
|
||||
struct __is_pointer
|
||||
{
|
||||
enum { __value = 0 };
|
||||
typedef __false_type __type;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct __is_pointer<_Tp*>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
*/
|
||||
|
||||
//
|
||||
// Normal iterator type
|
||||
//
|
||||
template<typename _Tp>
|
||||
struct __is_normal_iterator
|
||||
{
|
||||
enum { __value = 0 };
|
||||
typedef __false_type __type;
|
||||
};
|
||||
|
||||
template<typename _Iterator, typename _Container>
|
||||
struct __is_normal_iterator< __gnu_cxx::__normal_iterator<_Iterator,
|
||||
_Container> >
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
/*
|
||||
//
|
||||
// An arithmetic type is an integer type or a floating point type
|
||||
//
|
||||
template<typename _Tp>
|
||||
struct __is_arithmetic
|
||||
: public __traitor<__is_integer<_Tp>, __is_floating<_Tp> >
|
||||
{ };
|
||||
|
||||
//
|
||||
// A scalar type is an arithmetic type or a pointer type
|
||||
//
|
||||
template<typename _Tp>
|
||||
struct __is_scalar
|
||||
: public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> >
|
||||
{ };
|
||||
*/
|
||||
|
||||
//
|
||||
// For use in std::copy and std::find overloads for streambuf iterators.
|
||||
//
|
||||
template<typename _Tp>
|
||||
struct __is_char
|
||||
{
|
||||
enum { __value = 0 };
|
||||
typedef __false_type __type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_char<char>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
#ifdef _GLIBCXX_USE_WCHAR_T
|
||||
template<>
|
||||
struct __is_char<wchar_t>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
#endif
|
||||
|
||||
template<typename _Tp>
|
||||
struct __is_byte
|
||||
{
|
||||
enum { __value = 0 };
|
||||
typedef __false_type __type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_byte<char>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_byte<signed char>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_byte<unsigned char>
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
|
||||
//
|
||||
// Move iterator type
|
||||
//
|
||||
template<typename _Tp>
|
||||
struct __is_move_iterator
|
||||
{
|
||||
enum { __value = 0 };
|
||||
typedef __false_type __type;
|
||||
};
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _Iterator>
|
||||
class move_iterator;
|
||||
|
||||
template<typename _Iterator>
|
||||
struct __is_move_iterator< move_iterator<_Iterator> >
|
||||
{
|
||||
enum { __value = 1 };
|
||||
typedef __true_type __type;
|
||||
};
|
||||
#endif
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
||||
|
||||
#endif //_CPP_TYPE_TRAITS_H
|
|
@ -1,45 +0,0 @@
|
|||
// -fno-exceptions Support -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/exception_defines.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{exception}
|
||||
*/
|
||||
|
||||
#ifndef _EXCEPTION_DEFINES_H
|
||||
#define _EXCEPTION_DEFINES_H 1
|
||||
|
||||
#ifndef __EXCEPTIONS
|
||||
// Iff -fno-exceptions, transform error handling code to work without it.
|
||||
# define __try if (true)
|
||||
# define __catch(X) if (false)
|
||||
# define __throw_exception_again
|
||||
#else
|
||||
// Else proceed normally.
|
||||
# define __try try
|
||||
# define __catch(X) catch(X)
|
||||
# define __throw_exception_again throw
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,111 +0,0 @@
|
|||
// Aligned memory buffer -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2013-2014 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file ext/aligned_buffer.h
|
||||
* This file is a GNU extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <bits/c++0x_warning.h>
|
||||
#endif
|
||||
|
||||
namespace __gnu_cxx {
|
||||
// A utility type containing a POD object that can hold an object of type
|
||||
// _Tp initialized via placement new or allocator_traits::construct.
|
||||
// Intended for use as a data member subobject, use __aligned_buffer for
|
||||
// complete objects.
|
||||
template<typename _Tp>
|
||||
struct __aligned_membuf
|
||||
{
|
||||
// Target macro ADJUST_FIELD_ALIGN can produce different alignment for
|
||||
// types when used as class members. __aligned_membuf is intended
|
||||
// for use as a class member, so align the buffer as for a class member.
|
||||
struct _Tp2 { _Tp _M_t; };
|
||||
|
||||
alignas(__alignof__(_Tp2::_M_t)) unsigned char _M_storage[sizeof(_Tp)];
|
||||
|
||||
__aligned_membuf() = default;
|
||||
|
||||
// Can be used to avoid value-initialization zeroing _M_storage.
|
||||
__aligned_membuf(std::nullptr_t) { }
|
||||
|
||||
void*
|
||||
_M_addr() noexcept
|
||||
{ return static_cast<void*>(&_M_storage); }
|
||||
|
||||
const void*
|
||||
_M_addr() const noexcept
|
||||
{ return static_cast<const void*>(&_M_storage); }
|
||||
|
||||
_Tp*
|
||||
_M_ptr() noexcept
|
||||
{ return static_cast<_Tp*>(_M_addr()); }
|
||||
|
||||
const _Tp*
|
||||
_M_ptr() const noexcept
|
||||
{ return static_cast<const _Tp*>(_M_addr()); }
|
||||
};
|
||||
|
||||
// Similar to __aligned_membuf but aligned for complete objects, not members.
|
||||
// This type is used in <forward_list>, <future>, <bits/shared_ptr_base.h>
|
||||
// and <bits/hashtable_policy.h>, but ideally they would use __aligned_membuf
|
||||
// instead, as it has smaller size for some types on some targets.
|
||||
// This type is still used to avoid an ABI change.
|
||||
template<typename _Tp>
|
||||
struct __aligned_buffer
|
||||
: std::aligned_storage<sizeof(_Tp), std::alignment_of<_Tp>::value>
|
||||
{
|
||||
typename
|
||||
std::aligned_storage<sizeof(_Tp), std::alignment_of<_Tp>::value>::type
|
||||
_M_storage;
|
||||
|
||||
void*
|
||||
_M_addr() noexcept
|
||||
{
|
||||
return static_cast<void*>(&_M_storage);
|
||||
}
|
||||
|
||||
const void*
|
||||
_M_addr() const noexcept
|
||||
{
|
||||
return static_cast<const void*>(&_M_storage);
|
||||
}
|
||||
|
||||
_Tp*
|
||||
_M_ptr() noexcept
|
||||
{ return static_cast<_Tp*>(_M_addr()); }
|
||||
|
||||
const _Tp*
|
||||
_M_ptr() const noexcept
|
||||
{ return static_cast<const _Tp*>(_M_addr()); }
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
@ -1,211 +0,0 @@
|
|||
// Allocator traits -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2011-2014 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file ext/alloc_traits.h
|
||||
* This file is a GNU extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include "../alloc_traits.h"
|
||||
#else
|
||||
# include <bits/allocator.h> // for __alloc_swap
|
||||
#endif
|
||||
#include "../c++config.h"
|
||||
|
||||
namespace __gnu_cxx {
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _Alloc>
|
||||
struct __allocator_always_compares_equal : std::false_type { };
|
||||
|
||||
template<typename _Tp>
|
||||
struct __allocator_always_compares_equal<std::allocator<_Tp>>
|
||||
: std::true_type { };
|
||||
|
||||
template<typename, typename> struct array_allocator;
|
||||
|
||||
template<typename _Tp, typename _Array>
|
||||
struct __allocator_always_compares_equal<array_allocator<_Tp, _Array>>
|
||||
: std::true_type { };
|
||||
|
||||
template<typename> struct bitmap_allocator;
|
||||
|
||||
template<typename _Tp>
|
||||
struct __allocator_always_compares_equal<bitmap_allocator<_Tp>>
|
||||
: std::true_type { };
|
||||
|
||||
template<typename> struct malloc_allocator;
|
||||
|
||||
template<typename _Tp>
|
||||
struct __allocator_always_compares_equal<malloc_allocator<_Tp>>
|
||||
: std::true_type { };
|
||||
|
||||
template<typename> struct mt_allocator;
|
||||
|
||||
template<typename _Tp>
|
||||
struct __allocator_always_compares_equal<mt_allocator<_Tp>>
|
||||
: std::true_type { };
|
||||
|
||||
template<typename> struct new_allocator;
|
||||
|
||||
template<typename _Tp>
|
||||
struct __allocator_always_compares_equal<new_allocator<_Tp>>
|
||||
: std::true_type { };
|
||||
|
||||
template<typename> struct pool_allocator;
|
||||
|
||||
template<typename _Tp>
|
||||
struct __allocator_always_compares_equal<pool_allocator<_Tp>>
|
||||
: std::true_type { };
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Uniform interface to C++98 and C++0x allocators.
|
||||
* @ingroup allocators
|
||||
*/
|
||||
template<typename _Alloc>
|
||||
struct __alloc_traits
|
||||
#if __cplusplus >= 201103L
|
||||
: std::allocator_traits<_Alloc>
|
||||
#endif
|
||||
{
|
||||
typedef _Alloc allocator_type;
|
||||
#if __cplusplus >= 201103L
|
||||
typedef std::allocator_traits<_Alloc> _Base_type;
|
||||
typedef typename _Base_type::value_type value_type;
|
||||
typedef typename _Base_type::pointer pointer;
|
||||
typedef typename _Base_type::const_pointer const_pointer;
|
||||
typedef typename _Base_type::size_type size_type;
|
||||
typedef typename _Base_type::difference_type difference_type;
|
||||
// C++11 allocators do not define reference or const_reference
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
using _Base_type::allocate;
|
||||
using _Base_type::deallocate;
|
||||
using _Base_type::construct;
|
||||
using _Base_type::destroy;
|
||||
using _Base_type::max_size;
|
||||
|
||||
private:
|
||||
template<typename _Ptr>
|
||||
using __is_custom_pointer
|
||||
= std::conjunction<std::is_same<pointer, _Ptr>,
|
||||
geode::stl::__not_<std::is_pointer<_Ptr>>>;
|
||||
|
||||
public:
|
||||
// overload construct for non-standard pointer types
|
||||
template<typename _Ptr, typename... _Args>
|
||||
static typename std::enable_if<__is_custom_pointer<_Ptr>::value>::type
|
||||
construct(_Alloc& __a, _Ptr __p, _Args&&... __args)
|
||||
{
|
||||
_Base_type::construct(__a, std::addressof(*__p),
|
||||
std::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
// overload destroy for non-standard pointer types
|
||||
template<typename _Ptr>
|
||||
static typename std::enable_if<__is_custom_pointer<_Ptr>::value>::type
|
||||
destroy(_Alloc& __a, _Ptr __p)
|
||||
{ _Base_type::destroy(__a, std::addressof(*__p)); }
|
||||
|
||||
static _Alloc _S_select_on_copy(const _Alloc& __a)
|
||||
{ return _Base_type::select_on_container_copy_construction(__a); }
|
||||
|
||||
static void _S_on_swap(_Alloc& __a, _Alloc& __b)
|
||||
{ __alloc_on_swap(__a, __b); }
|
||||
|
||||
static constexpr bool _S_propagate_on_copy_assign()
|
||||
{ return _Base_type::propagate_on_container_copy_assignment::value; }
|
||||
|
||||
static constexpr bool _S_propagate_on_move_assign()
|
||||
{ return _Base_type::propagate_on_container_move_assignment::value; }
|
||||
|
||||
static constexpr bool _S_propagate_on_swap()
|
||||
{ return _Base_type::propagate_on_container_swap::value; }
|
||||
|
||||
static constexpr bool _S_always_equal()
|
||||
{ return __allocator_always_compares_equal<_Alloc>::value; }
|
||||
|
||||
static constexpr bool _S_nothrow_move()
|
||||
{ return _S_propagate_on_move_assign() || _S_always_equal(); }
|
||||
|
||||
static constexpr bool _S_nothrow_swap()
|
||||
{
|
||||
using std::swap;
|
||||
return !_S_propagate_on_swap()
|
||||
|| noexcept(swap(std::declval<_Alloc&>(), std::declval<_Alloc&>()));
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
struct rebind
|
||||
{ typedef typename _Base_type::template rebind_alloc<_Tp> other; };
|
||||
#else
|
||||
|
||||
typedef typename _Alloc::pointer pointer;
|
||||
typedef typename _Alloc::const_pointer const_pointer;
|
||||
typedef typename _Alloc::value_type value_type;
|
||||
typedef typename _Alloc::reference reference;
|
||||
typedef typename _Alloc::const_reference const_reference;
|
||||
typedef typename _Alloc::size_type size_type;
|
||||
typedef typename _Alloc::difference_type difference_type;
|
||||
|
||||
static pointer
|
||||
allocate(_Alloc& __a, size_type __n)
|
||||
{ return __a.allocate(__n); }
|
||||
|
||||
static void deallocate(_Alloc& __a, pointer __p, size_type __n)
|
||||
{ __a.deallocate(__p, __n); }
|
||||
|
||||
template<typename _Tp>
|
||||
static void construct(_Alloc& __a, pointer __p, const _Tp& __arg)
|
||||
{ __a.construct(__p, __arg); }
|
||||
|
||||
static void destroy(_Alloc& __a, pointer __p)
|
||||
{ __a.destroy(__p); }
|
||||
|
||||
static size_type max_size(const _Alloc& __a)
|
||||
{ return __a.max_size(); }
|
||||
|
||||
static const _Alloc& _S_select_on_copy(const _Alloc& __a) { return __a; }
|
||||
|
||||
static void _S_on_swap(_Alloc& __a, _Alloc& __b)
|
||||
{
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 431. Swapping containers with unequal allocators.
|
||||
std::__alloc_swap<_Alloc>::_S_do_it(__a, __b);
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
struct rebind
|
||||
{ typedef typename _Alloc::template rebind<_Tp>::other other; };
|
||||
#endif
|
||||
};
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace std
|
|
@ -1,155 +0,0 @@
|
|||
// Allocator that wraps operator new -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file ext/new_allocator.h
|
||||
* This file is a GNU extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _NEW_ALLOCATOR_H
|
||||
#define _NEW_ALLOCATOR_H 1
|
||||
|
||||
#include "../c++config.h"
|
||||
#include <new>
|
||||
#if __cplusplus >= 201103L
|
||||
#include <type_traits>
|
||||
#endif
|
||||
|
||||
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
using std::size_t;
|
||||
using std::ptrdiff_t;
|
||||
|
||||
/**
|
||||
* @brief An allocator that uses global new, as per [20.4].
|
||||
* @ingroup allocators
|
||||
*
|
||||
* This is precisely the allocator defined in the C++ Standard.
|
||||
* - all allocation calls operator new
|
||||
* - all deallocation calls operator delete
|
||||
*
|
||||
* @tparam _Tp Type of allocated object.
|
||||
*/
|
||||
template<typename _Tp>
|
||||
class new_allocator
|
||||
{
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef _Tp* pointer;
|
||||
typedef const _Tp* const_pointer;
|
||||
typedef _Tp& reference;
|
||||
typedef const _Tp& const_reference;
|
||||
typedef _Tp value_type;
|
||||
|
||||
template<typename _Tp1>
|
||||
struct rebind
|
||||
{ typedef new_allocator<_Tp1> other; };
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 2103. propagate_on_container_move_assignment
|
||||
typedef std::true_type propagate_on_container_move_assignment;
|
||||
#endif
|
||||
|
||||
new_allocator() _GLIBCXX_USE_NOEXCEPT { }
|
||||
|
||||
new_allocator(const new_allocator&) _GLIBCXX_USE_NOEXCEPT { }
|
||||
|
||||
template<typename _Tp1>
|
||||
new_allocator(const new_allocator<_Tp1>&) _GLIBCXX_USE_NOEXCEPT { }
|
||||
|
||||
~new_allocator() _GLIBCXX_USE_NOEXCEPT { }
|
||||
|
||||
pointer
|
||||
address(reference __x) const _GLIBCXX_NOEXCEPT
|
||||
{ return std::addressof(__x); }
|
||||
|
||||
const_pointer
|
||||
address(const_reference __x) const _GLIBCXX_NOEXCEPT
|
||||
{ return std::addressof(__x); }
|
||||
|
||||
// NB: __n is permitted to be 0. The C++ standard says nothing
|
||||
// about what the return value is when __n == 0.
|
||||
pointer
|
||||
allocate(size_type __n, const void* = 0)
|
||||
{
|
||||
if (__n > this->max_size())
|
||||
std::__throw_bad_alloc();
|
||||
|
||||
return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
|
||||
}
|
||||
|
||||
#ifdef __GXX_DELETE_WITH_SIZE__
|
||||
// __p is not permitted to be a null pointer.
|
||||
void
|
||||
deallocate(pointer __p, size_type __t)
|
||||
{ ::operator delete(__p, __t * sizeof(_Tp)); }
|
||||
#else
|
||||
// __p is not permitted to be a null pointer.
|
||||
void
|
||||
deallocate(pointer __p, size_type)
|
||||
{ ::operator delete(__p); }
|
||||
#endif
|
||||
|
||||
size_type
|
||||
max_size() const _GLIBCXX_USE_NOEXCEPT
|
||||
{ return size_t(-1) / sizeof(_Tp); }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _Up, typename... _Args>
|
||||
void
|
||||
construct(_Up* __p, _Args&&... __args)
|
||||
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
|
||||
|
||||
template<typename _Up>
|
||||
void
|
||||
destroy(_Up* __p) { __p->~_Up(); }
|
||||
#else
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 402. wrong new expression in [some_] allocator::construct
|
||||
void
|
||||
construct(pointer __p, const _Tp& __val)
|
||||
{ ::new((void *)__p) _Tp(__val); }
|
||||
|
||||
void
|
||||
destroy(pointer __p) { __p->~_Tp(); }
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
inline bool
|
||||
operator==(const new_allocator<_Tp>&, const new_allocator<_Tp>&)
|
||||
{ return true; }
|
||||
|
||||
template<typename _Tp>
|
||||
inline bool
|
||||
operator!=(const new_allocator<_Tp>&, const new_allocator<_Tp>&)
|
||||
{ return false; }
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
||||
|
||||
#endif
|
|
@ -1,135 +0,0 @@
|
|||
// -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2007-2014 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the terms
|
||||
// of the GNU General Public License as published by the Free Software
|
||||
// Foundation; either version 3, or (at your option) any later
|
||||
// version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file ext/numeric_traits.h
|
||||
* This file is a GNU extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include <type_traits>
|
||||
#include "../c++config.h"
|
||||
|
||||
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
// Compile time constants for builtin types.
|
||||
// Sadly std::numeric_limits member functions cannot be used for this.
|
||||
#define __glibcxx_signed(_Tp) ((_Tp)(-1) < 0)
|
||||
#define __glibcxx_digits(_Tp) \
|
||||
(sizeof(_Tp) * __CHAR_BIT__ - __glibcxx_signed(_Tp))
|
||||
|
||||
#define __glibcxx_min(_Tp) \
|
||||
(__glibcxx_signed(_Tp) ? (_Tp)1 << __glibcxx_digits(_Tp) : (_Tp)0)
|
||||
|
||||
#define __glibcxx_max(_Tp) \
|
||||
(__glibcxx_signed(_Tp) ? \
|
||||
(((((_Tp)1 << (__glibcxx_digits(_Tp) - 1)) - 1) << 1) + 1) : ~(_Tp)0)
|
||||
|
||||
template<typename _Value>
|
||||
struct __numeric_traits_integer
|
||||
{
|
||||
// Only integers for initialization of member constant.
|
||||
static const _Value __min = __glibcxx_min(_Value);
|
||||
static const _Value __max = __glibcxx_max(_Value);
|
||||
|
||||
// NB: these two also available in std::numeric_limits as compile
|
||||
// time constants, but <limits> is big and we avoid including it.
|
||||
static const bool __is_signed = __glibcxx_signed(_Value);
|
||||
static const int __digits = __glibcxx_digits(_Value);
|
||||
};
|
||||
|
||||
template<typename _Value>
|
||||
const _Value __numeric_traits_integer<_Value>::__min;
|
||||
|
||||
template<typename _Value>
|
||||
const _Value __numeric_traits_integer<_Value>::__max;
|
||||
|
||||
template<typename _Value>
|
||||
const bool __numeric_traits_integer<_Value>::__is_signed;
|
||||
|
||||
template<typename _Value>
|
||||
const int __numeric_traits_integer<_Value>::__digits;
|
||||
|
||||
#undef __glibcxx_signed
|
||||
#undef __glibcxx_digits
|
||||
#undef __glibcxx_min
|
||||
#undef __glibcxx_max
|
||||
|
||||
#define __glibcxx_floating(_Tp, _Fval, _Dval, _LDval) \
|
||||
(std::is_same<_Tp, float>::__value ? _Fval \
|
||||
: std::is_same<_Tp, double>::__value ? _Dval : _LDval)
|
||||
|
||||
#define __glibcxx_max_digits10(_Tp) \
|
||||
(2 + __glibcxx_floating(_Tp, __FLT_MANT_DIG__, __DBL_MANT_DIG__, \
|
||||
__LDBL_MANT_DIG__) * 643L / 2136)
|
||||
|
||||
#define __glibcxx_digits10(_Tp) \
|
||||
__glibcxx_floating(_Tp, __FLT_DIG__, __DBL_DIG__, __LDBL_DIG__)
|
||||
|
||||
#define __glibcxx_max_exponent10(_Tp) \
|
||||
__glibcxx_floating(_Tp, __FLT_MAX_10_EXP__, __DBL_MAX_10_EXP__, \
|
||||
__LDBL_MAX_10_EXP__)
|
||||
|
||||
template<typename _Value>
|
||||
struct __numeric_traits_floating
|
||||
{
|
||||
// Only floating point types. See N1822.
|
||||
static const int __max_digits10 = __glibcxx_max_digits10(_Value);
|
||||
|
||||
// See above comment...
|
||||
static const bool __is_signed = true;
|
||||
static const int __digits10 = __glibcxx_digits10(_Value);
|
||||
static const int __max_exponent10 = __glibcxx_max_exponent10(_Value);
|
||||
};
|
||||
|
||||
template<typename _Value>
|
||||
const int __numeric_traits_floating<_Value>::__max_digits10;
|
||||
|
||||
template<typename _Value>
|
||||
const bool __numeric_traits_floating<_Value>::__is_signed;
|
||||
|
||||
template<typename _Value>
|
||||
const int __numeric_traits_floating<_Value>::__digits10;
|
||||
|
||||
template<typename _Value>
|
||||
const int __numeric_traits_floating<_Value>::__max_exponent10;
|
||||
|
||||
template<typename _Value>
|
||||
struct __numeric_traits
|
||||
: public std::conditional<std::is_integral<_Value>::__value,
|
||||
__numeric_traits_integer<_Value>,
|
||||
__numeric_traits_floating<_Value> >::__type
|
||||
{ };
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
||||
|
||||
#undef __glibcxx_floating
|
||||
#undef __glibcxx_max_digits10
|
||||
#undef __glibcxx_digits10
|
||||
#undef __glibcxx_max_exponent10
|
|
@ -1,87 +0,0 @@
|
|||
// rb_tree extension -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2002-2014 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1996
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*/
|
||||
|
||||
/** @file ext/rb_tree
|
||||
* This file is a GNU extension to the Standard C++ Library (possibly
|
||||
* containing extensions from the HP/SGI STL subset).
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../stl_tree.h"
|
||||
|
||||
namespace geode::stl {
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
// Class rb_tree is not part of the C++ standard. It is provided for
|
||||
// compatibility with the HP STL.
|
||||
|
||||
/**
|
||||
* This is an SGI extension.
|
||||
* @ingroup SGIextensions
|
||||
* @doctodo
|
||||
*/
|
||||
template <class _Key, class _Value, class _KeyOfValue, class _Compare,
|
||||
class _Alloc = allocator<_Value> >
|
||||
struct rb_tree
|
||||
: public _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc>
|
||||
{
|
||||
typedef _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc> _Base;
|
||||
typedef typename _Base::allocator_type allocator_type;
|
||||
|
||||
rb_tree(const _Compare& __comp = _Compare(),
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__comp, __a) { }
|
||||
|
||||
~rb_tree() { }
|
||||
};
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
|
@ -1,211 +0,0 @@
|
|||
// functional_hash.h header -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2007-2014 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/functional_hash.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{functional}
|
||||
*/
|
||||
|
||||
#ifndef _FUNCTIONAL_HASH_H
|
||||
#define _FUNCTIONAL_HASH_H 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include "hash_bytes.h"
|
||||
|
||||
namespace geode::stl {
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
/** @defgroup hashes Hashes
|
||||
* @ingroup functors
|
||||
*
|
||||
* Hashing functors taking a variable type and returning a @c std::size_t.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
template<typename _Result, typename _Arg>
|
||||
struct __hash_base
|
||||
{
|
||||
typedef _Result result_type;
|
||||
typedef _Arg argument_type;
|
||||
};
|
||||
|
||||
/// Primary class template hash.
|
||||
template<typename _Tp>
|
||||
struct hash;
|
||||
|
||||
/// Partial specializations for pointer types.
|
||||
template<typename _Tp>
|
||||
struct hash<_Tp*> : public __hash_base<size_t, _Tp*>
|
||||
{
|
||||
size_t
|
||||
operator()(_Tp* __p) const noexcept
|
||||
{ return reinterpret_cast<size_t>(__p); }
|
||||
};
|
||||
|
||||
// Explicit specializations for integer types.
|
||||
#define _Cxx_hashtable_define_trivial_hash(_Tp) \
|
||||
template<> \
|
||||
struct hash<_Tp> : public __hash_base<size_t, _Tp> \
|
||||
{ \
|
||||
size_t \
|
||||
operator()(_Tp __val) const noexcept \
|
||||
{ return static_cast<size_t>(__val); } \
|
||||
};
|
||||
|
||||
/// Explicit specialization for bool.
|
||||
_Cxx_hashtable_define_trivial_hash(bool)
|
||||
|
||||
/// Explicit specialization for char.
|
||||
_Cxx_hashtable_define_trivial_hash(char)
|
||||
|
||||
/// Explicit specialization for signed char.
|
||||
_Cxx_hashtable_define_trivial_hash(signed char)
|
||||
|
||||
/// Explicit specialization for unsigned char.
|
||||
_Cxx_hashtable_define_trivial_hash(unsigned char)
|
||||
|
||||
/// Explicit specialization for wchar_t.
|
||||
_Cxx_hashtable_define_trivial_hash(wchar_t)
|
||||
|
||||
/// Explicit specialization for char16_t.
|
||||
_Cxx_hashtable_define_trivial_hash(char16_t)
|
||||
|
||||
/// Explicit specialization for char32_t.
|
||||
_Cxx_hashtable_define_trivial_hash(char32_t)
|
||||
|
||||
/// Explicit specialization for short.
|
||||
_Cxx_hashtable_define_trivial_hash(short)
|
||||
|
||||
/// Explicit specialization for int.
|
||||
_Cxx_hashtable_define_trivial_hash(int)
|
||||
|
||||
/// Explicit specialization for long.
|
||||
_Cxx_hashtable_define_trivial_hash(long)
|
||||
|
||||
/// Explicit specialization for long long.
|
||||
_Cxx_hashtable_define_trivial_hash(long long)
|
||||
|
||||
/// Explicit specialization for unsigned short.
|
||||
_Cxx_hashtable_define_trivial_hash(unsigned short)
|
||||
|
||||
/// Explicit specialization for unsigned int.
|
||||
_Cxx_hashtable_define_trivial_hash(unsigned int)
|
||||
|
||||
/// Explicit specialization for unsigned long.
|
||||
_Cxx_hashtable_define_trivial_hash(unsigned long)
|
||||
|
||||
/// Explicit specialization for unsigned long long.
|
||||
_Cxx_hashtable_define_trivial_hash(unsigned long long)
|
||||
|
||||
#undef _Cxx_hashtable_define_trivial_hash
|
||||
|
||||
struct _Hash_impl
|
||||
{
|
||||
static size_t
|
||||
hash(const void* __ptr, size_t __clength,
|
||||
size_t __seed = static_cast<size_t>(0xc70f6907UL))
|
||||
{ return _Hash_bytes(__ptr, __clength, __seed); }
|
||||
|
||||
template<typename _Tp>
|
||||
static size_t
|
||||
hash(const _Tp& __val)
|
||||
{ return hash(&__val, sizeof(__val)); }
|
||||
|
||||
template<typename _Tp>
|
||||
static size_t
|
||||
__hash_combine(const _Tp& __val, size_t __hash)
|
||||
{ return hash(&__val, sizeof(__val), __hash); }
|
||||
};
|
||||
|
||||
struct _Fnv_hash_impl
|
||||
{
|
||||
static size_t
|
||||
hash(const void* __ptr, size_t __clength,
|
||||
size_t __seed = static_cast<size_t>(2166136261UL))
|
||||
{ return _Fnv_hash_bytes(__ptr, __clength, __seed); }
|
||||
|
||||
template<typename _Tp>
|
||||
static size_t
|
||||
hash(const _Tp& __val)
|
||||
{ return hash(&__val, sizeof(__val)); }
|
||||
|
||||
template<typename _Tp>
|
||||
static size_t
|
||||
__hash_combine(const _Tp& __val, size_t __hash)
|
||||
{ return hash(&__val, sizeof(__val), __hash); }
|
||||
};
|
||||
|
||||
/// Specialization for float.
|
||||
template<>
|
||||
struct hash<float> : public __hash_base<size_t, float>
|
||||
{
|
||||
size_t
|
||||
operator()(float __val) const noexcept
|
||||
{
|
||||
// 0 and -0 both hash to zero.
|
||||
return __val != 0.0f ? _Hash_impl::hash(__val) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
/// Specialization for double.
|
||||
template<>
|
||||
struct hash<double> : public __hash_base<size_t, double>
|
||||
{
|
||||
size_t
|
||||
operator()(double __val) const noexcept
|
||||
{
|
||||
// 0 and -0 both hash to zero.
|
||||
return __val != 0.0 ? _Hash_impl::hash(__val) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
/// Specialization for long double.
|
||||
template<>
|
||||
struct hash<long double>
|
||||
: public __hash_base<size_t, long double>
|
||||
{
|
||||
_GLIBCXX_PURE size_t
|
||||
operator()(long double __val) const noexcept;
|
||||
};
|
||||
|
||||
// @} group hashes
|
||||
|
||||
// Hint about performance of hash functor. If not fast the hash based
|
||||
// containers will cache the hash code.
|
||||
// Default behavior is to consider that hasher are fast unless specified
|
||||
// otherwise.
|
||||
template<typename _Hash>
|
||||
struct __is_fast_hash : public std::true_type
|
||||
{ };
|
||||
|
||||
template<>
|
||||
struct __is_fast_hash<hash<long double>> : public std::false_type
|
||||
{ };
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
||||
|
||||
#endif // _FUNCTIONAL_HASH_H
|
|
@ -1,58 +0,0 @@
|
|||
// Declarations for hash functions. -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2010-2014 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/hash_bytes.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{functional}
|
||||
*/
|
||||
|
||||
#ifndef _HASH_BYTES_H
|
||||
#define _HASH_BYTES_H 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include "c++config.h"
|
||||
|
||||
namespace geode::stl {
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
// Hash function implementation for the nontrivial specialization.
|
||||
// All of them are based on a primitive that hashes a pointer to a
|
||||
// byte array. The actual hash algorithm is not guaranteed to stay
|
||||
// the same from release to release -- it may be updated or tuned to
|
||||
// improve hash quality or speed.
|
||||
size_t
|
||||
_Hash_bytes(const void* __ptr, size_t __len, size_t __seed);
|
||||
|
||||
// A similar hash primitive, using the FNV hash algorithm. This
|
||||
// algorithm is guaranteed to stay the same from release to release.
|
||||
// (although it might not produce the same values on different
|
||||
// machines.)
|
||||
size_t
|
||||
_Fnv_hash_bytes(const void* __ptr, size_t __len, size_t __seed);
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
||||
|
||||
#endif
|
|
@ -1,11 +0,0 @@
|
|||
#pragma once
|
||||
#include "functional_hash.h"
|
||||
|
||||
namespace geode::stl {
|
||||
template <>
|
||||
struct hash<gd::string> : public __hash_base<size_t, gd::string> {
|
||||
size_t operator()(const gd::string& s) const noexcept {
|
||||
return _Hash_impl::hash(s.data(), s.size());
|
||||
}
|
||||
};
|
||||
}
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,77 +0,0 @@
|
|||
// <memory> Forward declarations -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-1997
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*/
|
||||
|
||||
/** @file bits/memoryfwd.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{memory}
|
||||
*/
|
||||
|
||||
#ifndef _MEMORYFWD_H
|
||||
#define _MEMORYFWD_H 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include "c++config.h"
|
||||
|
||||
namespace geode::stl {
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
/**
|
||||
* @defgroup allocators Allocators
|
||||
* @ingroup memory
|
||||
*
|
||||
* Classes encapsulating memory operations.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
template<typename>
|
||||
class allocator;
|
||||
|
||||
template<>
|
||||
class allocator<void>;
|
||||
|
||||
/// Declare uses_allocator so it can be specialized in \<queue\> etc.
|
||||
template<typename, typename>
|
||||
struct uses_allocator;
|
||||
|
||||
/// @} group memory
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace std
|
||||
|
||||
#endif
|
|
@ -1,205 +0,0 @@
|
|||
// Move, forward and identity for C++0x + swap -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2007-2014 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/move.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{utility}
|
||||
*/
|
||||
|
||||
#ifndef _MOVE_H
|
||||
#define _MOVE_H 1
|
||||
|
||||
#include "c++config.h"
|
||||
#include "concept_check.h"
|
||||
|
||||
namespace geode::stl {
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
// Used, in C++03 mode too, by allocators, etc.
|
||||
/**
|
||||
* @brief Same as C++11 std::addressof
|
||||
* @ingroup utilities
|
||||
*/
|
||||
template<typename _Tp>
|
||||
inline _Tp*
|
||||
__addressof(_Tp& __r) _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
return reinterpret_cast<_Tp*>
|
||||
(&const_cast<char&>(reinterpret_cast<const volatile char&>(__r)));
|
||||
}
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
#include <type_traits> // Brings in std::declval too.
|
||||
|
||||
namespace geode::stl {
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
/**
|
||||
* @addtogroup utilities
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Forward an lvalue.
|
||||
* @return The parameter cast to the specified type.
|
||||
*
|
||||
* This function is used to implement "perfect forwarding".
|
||||
*/
|
||||
template<typename _Tp>
|
||||
constexpr _Tp&&
|
||||
forward(typename std::remove_reference<_Tp>::type& __t) noexcept
|
||||
{ return static_cast<_Tp&&>(__t); }
|
||||
|
||||
/**
|
||||
* @brief Forward an rvalue.
|
||||
* @return The parameter cast to the specified type.
|
||||
*
|
||||
* This function is used to implement "perfect forwarding".
|
||||
*/
|
||||
template<typename _Tp>
|
||||
constexpr _Tp&&
|
||||
forward(typename std::remove_reference<_Tp>::type&& __t) noexcept
|
||||
{
|
||||
static_assert(!std::is_lvalue_reference<_Tp>::value, "template argument"
|
||||
" substituting _Tp is an lvalue reference type");
|
||||
return static_cast<_Tp&&>(__t);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert a value to an rvalue.
|
||||
* @param __t A thing of arbitrary type.
|
||||
* @return The parameter cast to an rvalue-reference to allow moving it.
|
||||
*/
|
||||
template<typename _Tp>
|
||||
constexpr typename std::remove_reference<_Tp>::type&&
|
||||
move(_Tp&& __t) noexcept
|
||||
{ return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
|
||||
|
||||
|
||||
template<typename _Tp>
|
||||
struct __move_if_noexcept_cond
|
||||
: public __and_<__not_<std::is_nothrow_move_constructible<_Tp>>,
|
||||
std::is_copy_constructible<_Tp>>::type { };
|
||||
|
||||
/**
|
||||
* @brief Conditionally convert a value to an rvalue.
|
||||
* @param __x A thing of arbitrary type.
|
||||
* @return The parameter, possibly cast to an rvalue-reference.
|
||||
*
|
||||
* Same as std::move unless the type's move constructor could throw and the
|
||||
* type is copyable, in which case an lvalue-reference is returned instead.
|
||||
*/
|
||||
template<typename _Tp>
|
||||
constexpr typename
|
||||
std::conditional<__move_if_noexcept_cond<_Tp>::value, const _Tp&, _Tp&&>::type
|
||||
move_if_noexcept(_Tp& __x) noexcept
|
||||
{ return std::move(__x); }
|
||||
|
||||
// declval, from type_traits.
|
||||
|
||||
/**
|
||||
* @brief Returns the actual address of the object or function
|
||||
* referenced by r, even in the presence of an overloaded
|
||||
* operator&.
|
||||
* @param __r Reference to an object or function.
|
||||
* @return The actual address.
|
||||
*/
|
||||
template<typename _Tp>
|
||||
inline _Tp*
|
||||
addressof(_Tp& __r) noexcept
|
||||
{ return __addressof(__r); }
|
||||
|
||||
// C++11 version of std::exchange for internal use.
|
||||
template <typename _Tp, typename _Up = _Tp>
|
||||
inline _Tp
|
||||
__exchange(_Tp& __obj, _Up&& __new_val)
|
||||
{
|
||||
_Tp __old_val = std::move(__obj);
|
||||
__obj = std::forward<_Up>(__new_val);
|
||||
return __old_val;
|
||||
}
|
||||
|
||||
/// @} group utilities
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
||||
|
||||
#define _GLIBCXX_MOVE(__val) std::move(__val)
|
||||
#define _GLIBCXX_FORWARD(_Tp, __val) std::forward<_Tp>(__val)
|
||||
#else
|
||||
#define _GLIBCXX_MOVE(__val) (__val)
|
||||
#define _GLIBCXX_FORWARD(_Tp, __val) (__val)
|
||||
#endif
|
||||
|
||||
namespace geode::stl {
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
/**
|
||||
* @addtogroup utilities
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Swaps two values.
|
||||
* @param __a A thing of arbitrary type.
|
||||
* @param __b Another thing of arbitrary type.
|
||||
* @return Nothing.
|
||||
*/
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
swap(_Tp& __a, _Tp& __b)
|
||||
#if __cplusplus >= 201103L
|
||||
noexcept(__and_<std::is_nothrow_move_constructible<_Tp>,
|
||||
std::is_nothrow_move_assignable<_Tp>>::value)
|
||||
#endif
|
||||
{
|
||||
// concept requirements
|
||||
__glibcxx_function_requires(_SGIAssignableConcept<_Tp>)
|
||||
|
||||
_Tp __tmp = _GLIBCXX_MOVE(__a);
|
||||
__a = _GLIBCXX_MOVE(__b);
|
||||
__b = _GLIBCXX_MOVE(__tmp);
|
||||
}
|
||||
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// DR 809. std::swap should be overloaded for array types.
|
||||
/// Swap the contents of two arrays.
|
||||
template<typename _Tp, size_t _Nm>
|
||||
inline void
|
||||
swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
|
||||
#if __cplusplus >= 201103L
|
||||
noexcept(noexcept(swap(*__a, *__b)))
|
||||
#endif
|
||||
{
|
||||
for (size_t __n = 0; __n < _Nm; ++__n)
|
||||
swap(__a[__n], __b[__n]);
|
||||
}
|
||||
|
||||
/// @} group utilities
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
||||
|
||||
#endif /* _MOVE_H */
|
|
@ -1,157 +0,0 @@
|
|||
// Allocator that wraps operator new -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file ext/new_allocator.h
|
||||
* This file is a GNU extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _NEW_ALLOCATOR_H
|
||||
#define _NEW_ALLOCATOR_H 1
|
||||
|
||||
#include "c++config.h"
|
||||
#include <new>
|
||||
#include <bits/functexcept.h>
|
||||
#include <bits/move.h>
|
||||
#if __cplusplus >= 201103L
|
||||
#include <type_traits>
|
||||
#endif
|
||||
|
||||
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
using std::size_t;
|
||||
using std::ptrdiff_t;
|
||||
|
||||
/**
|
||||
* @brief An allocator that uses global new, as per [20.4].
|
||||
* @ingroup allocators
|
||||
*
|
||||
* This is precisely the allocator defined in the C++ Standard.
|
||||
* - all allocation calls operator new
|
||||
* - all deallocation calls operator delete
|
||||
*
|
||||
* @tparam _Tp Type of allocated object.
|
||||
*/
|
||||
template<typename _Tp>
|
||||
class new_allocator
|
||||
{
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef _Tp* pointer;
|
||||
typedef const _Tp* const_pointer;
|
||||
typedef _Tp& reference;
|
||||
typedef const _Tp& const_reference;
|
||||
typedef _Tp value_type;
|
||||
|
||||
template<typename _Tp1>
|
||||
struct rebind
|
||||
{ typedef new_allocator<_Tp1> other; };
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 2103. propagate_on_container_move_assignment
|
||||
typedef std::true_type propagate_on_container_move_assignment;
|
||||
#endif
|
||||
|
||||
new_allocator() _GLIBCXX_USE_NOEXCEPT { }
|
||||
|
||||
new_allocator(const new_allocator&) _GLIBCXX_USE_NOEXCEPT { }
|
||||
|
||||
template<typename _Tp1>
|
||||
new_allocator(const new_allocator<_Tp1>&) _GLIBCXX_USE_NOEXCEPT { }
|
||||
|
||||
~new_allocator() _GLIBCXX_USE_NOEXCEPT { }
|
||||
|
||||
pointer
|
||||
address(reference __x) const _GLIBCXX_NOEXCEPT
|
||||
{ return std::__addressof(__x); }
|
||||
|
||||
const_pointer
|
||||
address(const_reference __x) const _GLIBCXX_NOEXCEPT
|
||||
{ return std::__addressof(__x); }
|
||||
|
||||
// NB: __n is permitted to be 0. The C++ standard says nothing
|
||||
// about what the return value is when __n == 0.
|
||||
pointer
|
||||
allocate(size_type __n, const void* = 0)
|
||||
{
|
||||
if (__n > this->max_size())
|
||||
std::__throw_bad_alloc();
|
||||
|
||||
return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
|
||||
}
|
||||
|
||||
#ifdef __GXX_DELETE_WITH_SIZE__
|
||||
// __p is not permitted to be a null pointer.
|
||||
void
|
||||
deallocate(pointer __p, size_type __t)
|
||||
{ ::operator delete(__p, __t * sizeof(_Tp)); }
|
||||
#else
|
||||
// __p is not permitted to be a null pointer.
|
||||
void
|
||||
deallocate(pointer __p, size_type)
|
||||
{ ::operator delete(__p); }
|
||||
#endif
|
||||
|
||||
size_type
|
||||
max_size() const _GLIBCXX_USE_NOEXCEPT
|
||||
{ return size_t(-1) / sizeof(_Tp); }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _Up, typename... _Args>
|
||||
void
|
||||
construct(_Up* __p, _Args&&... __args)
|
||||
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
|
||||
|
||||
template<typename _Up>
|
||||
void
|
||||
destroy(_Up* __p) { __p->~_Up(); }
|
||||
#else
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 402. wrong new expression in [some_] allocator::construct
|
||||
void
|
||||
construct(pointer __p, const _Tp& __val)
|
||||
{ ::new((void *)__p) _Tp(__val); }
|
||||
|
||||
void
|
||||
destroy(pointer __p) { __p->~_Tp(); }
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
inline bool
|
||||
operator==(const new_allocator<_Tp>&, const new_allocator<_Tp>&)
|
||||
{ return true; }
|
||||
|
||||
template<typename _Tp>
|
||||
inline bool
|
||||
operator!=(const new_allocator<_Tp>&, const new_allocator<_Tp>&)
|
||||
{ return false; }
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
||||
|
||||
#endif
|
|
@ -1,304 +0,0 @@
|
|||
// Default predicates for internal use -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2013-2014 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file predefined_ops.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PREDEFINED_OPS_H
|
||||
#define _GLIBCXX_PREDEFINED_OPS_H 1
|
||||
|
||||
namespace __gnu_cxx
|
||||
{
|
||||
namespace __ops
|
||||
{
|
||||
struct _Iter_less_iter
|
||||
{
|
||||
template<typename _Iterator1, typename _Iterator2>
|
||||
bool
|
||||
operator()(_Iterator1 __it1, _Iterator2 __it2) const
|
||||
{ return *__it1 < *__it2; }
|
||||
};
|
||||
|
||||
inline _Iter_less_iter
|
||||
__iter_less_iter()
|
||||
{ return _Iter_less_iter(); }
|
||||
|
||||
struct _Iter_less_val
|
||||
{
|
||||
template<typename _Iterator, typename _Value>
|
||||
bool
|
||||
operator()(_Iterator __it, _Value& __val) const
|
||||
{ return *__it < __val; }
|
||||
};
|
||||
|
||||
inline _Iter_less_val
|
||||
__iter_less_val()
|
||||
{ return _Iter_less_val(); }
|
||||
|
||||
inline _Iter_less_val
|
||||
__iter_comp_val(_Iter_less_iter)
|
||||
{ return _Iter_less_val(); }
|
||||
|
||||
struct _Val_less_iter
|
||||
{
|
||||
template<typename _Value, typename _Iterator>
|
||||
bool
|
||||
operator()(_Value& __val, _Iterator __it) const
|
||||
{ return __val < *__it; }
|
||||
};
|
||||
|
||||
inline _Val_less_iter
|
||||
__val_less_iter()
|
||||
{ return _Val_less_iter(); }
|
||||
|
||||
inline _Val_less_iter
|
||||
__val_comp_iter(_Iter_less_iter)
|
||||
{ return _Val_less_iter(); }
|
||||
|
||||
struct _Iter_equal_to_iter
|
||||
{
|
||||
template<typename _Iterator1, typename _Iterator2>
|
||||
bool
|
||||
operator()(_Iterator1 __it1, _Iterator2 __it2) const
|
||||
{ return *__it1 == *__it2; }
|
||||
};
|
||||
|
||||
inline _Iter_equal_to_iter
|
||||
__iter_equal_to_iter()
|
||||
{ return _Iter_equal_to_iter(); }
|
||||
|
||||
struct _Iter_equal_to_val
|
||||
{
|
||||
template<typename _Iterator, typename _Value>
|
||||
bool
|
||||
operator()(_Iterator __it, _Value& __val) const
|
||||
{ return *__it == __val; }
|
||||
};
|
||||
|
||||
inline _Iter_equal_to_val
|
||||
__iter_equal_to_val()
|
||||
{ return _Iter_equal_to_val(); }
|
||||
|
||||
inline _Iter_equal_to_val
|
||||
__iter_comp_val(_Iter_equal_to_iter)
|
||||
{ return _Iter_equal_to_val(); }
|
||||
|
||||
template<typename _Compare>
|
||||
struct _Iter_comp_iter
|
||||
{
|
||||
_Compare _M_comp;
|
||||
|
||||
_Iter_comp_iter(_Compare __comp)
|
||||
: _M_comp(__comp)
|
||||
{ }
|
||||
|
||||
template<typename _Iterator1, typename _Iterator2>
|
||||
bool
|
||||
operator()(_Iterator1 __it1, _Iterator2 __it2)
|
||||
{ return bool(_M_comp(*__it1, *__it2)); }
|
||||
};
|
||||
|
||||
template<typename _Compare>
|
||||
inline _Iter_comp_iter<_Compare>
|
||||
__iter_comp_iter(_Compare __comp)
|
||||
{ return _Iter_comp_iter<_Compare>(__comp); }
|
||||
|
||||
template<typename _Compare>
|
||||
struct _Iter_comp_val
|
||||
{
|
||||
_Compare _M_comp;
|
||||
|
||||
_Iter_comp_val(_Compare __comp)
|
||||
: _M_comp(__comp)
|
||||
{ }
|
||||
|
||||
template<typename _Iterator, typename _Value>
|
||||
bool
|
||||
operator()(_Iterator __it, _Value& __val)
|
||||
{ return bool(_M_comp(*__it, __val)); }
|
||||
};
|
||||
|
||||
template<typename _Compare>
|
||||
inline _Iter_comp_val<_Compare>
|
||||
__iter_comp_val(_Compare __comp)
|
||||
{ return _Iter_comp_val<_Compare>(__comp); }
|
||||
|
||||
template<typename _Compare>
|
||||
inline _Iter_comp_val<_Compare>
|
||||
__iter_comp_val(_Iter_comp_iter<_Compare> __comp)
|
||||
{ return _Iter_comp_val<_Compare>(__comp._M_comp); }
|
||||
|
||||
template<typename _Compare>
|
||||
struct _Val_comp_iter
|
||||
{
|
||||
_Compare _M_comp;
|
||||
|
||||
_Val_comp_iter(_Compare __comp)
|
||||
: _M_comp(__comp)
|
||||
{ }
|
||||
|
||||
template<typename _Value, typename _Iterator>
|
||||
bool
|
||||
operator()(_Value& __val, _Iterator __it)
|
||||
{ return bool(_M_comp(__val, *__it)); }
|
||||
};
|
||||
|
||||
template<typename _Compare>
|
||||
inline _Val_comp_iter<_Compare>
|
||||
__val_comp_iter(_Compare __comp)
|
||||
{ return _Val_comp_iter<_Compare>(__comp); }
|
||||
|
||||
template<typename _Compare>
|
||||
inline _Val_comp_iter<_Compare>
|
||||
__val_comp_iter(_Iter_comp_iter<_Compare> __comp)
|
||||
{ return _Val_comp_iter<_Compare>(__comp._M_comp); }
|
||||
|
||||
template<typename _Value>
|
||||
struct _Iter_equals_val
|
||||
{
|
||||
_Value& _M_value;
|
||||
|
||||
_Iter_equals_val(_Value& __value)
|
||||
: _M_value(__value)
|
||||
{ }
|
||||
|
||||
template<typename _Iterator>
|
||||
bool
|
||||
operator()(_Iterator __it)
|
||||
{ return *__it == _M_value; }
|
||||
};
|
||||
|
||||
template<typename _Value>
|
||||
inline _Iter_equals_val<_Value>
|
||||
__iter_equals_val(_Value& __val)
|
||||
{ return _Iter_equals_val<_Value>(__val); }
|
||||
|
||||
template<typename _Iterator1>
|
||||
struct _Iter_equals_iter
|
||||
{
|
||||
typename geode::stl::iterator_traits<_Iterator1>::reference _M_ref;
|
||||
|
||||
_Iter_equals_iter(_Iterator1 __it1)
|
||||
: _M_ref(*__it1)
|
||||
{ }
|
||||
|
||||
template<typename _Iterator2>
|
||||
bool
|
||||
operator()(_Iterator2 __it2)
|
||||
{ return *__it2 == _M_ref; }
|
||||
};
|
||||
|
||||
template<typename _Iterator>
|
||||
inline _Iter_equals_iter<_Iterator>
|
||||
__iter_comp_iter(_Iter_equal_to_iter, _Iterator __it)
|
||||
{ return _Iter_equals_iter<_Iterator>(__it); }
|
||||
|
||||
template<typename _Predicate>
|
||||
struct _Iter_pred
|
||||
{
|
||||
_Predicate _M_pred;
|
||||
|
||||
_Iter_pred(_Predicate __pred)
|
||||
: _M_pred(__pred)
|
||||
{ }
|
||||
|
||||
template<typename _Iterator>
|
||||
bool
|
||||
operator()(_Iterator __it)
|
||||
{ return bool(_M_pred(*__it)); }
|
||||
};
|
||||
|
||||
template<typename _Predicate>
|
||||
inline _Iter_pred<_Predicate>
|
||||
__pred_iter(_Predicate __pred)
|
||||
{ return _Iter_pred<_Predicate>(__pred); }
|
||||
|
||||
template<typename _Compare, typename _Value>
|
||||
struct _Iter_comp_to_val
|
||||
{
|
||||
_Compare _M_comp;
|
||||
_Value& _M_value;
|
||||
|
||||
_Iter_comp_to_val(_Compare __comp, _Value& __value)
|
||||
: _M_comp(__comp), _M_value(__value)
|
||||
{ }
|
||||
|
||||
template<typename _Iterator>
|
||||
bool
|
||||
operator()(_Iterator __it)
|
||||
{ return bool(_M_comp(*__it, _M_value)); }
|
||||
};
|
||||
|
||||
template<typename _Compare, typename _Value>
|
||||
_Iter_comp_to_val<_Compare, _Value>
|
||||
__iter_comp_val(_Compare __comp, _Value &__val)
|
||||
{ return _Iter_comp_to_val<_Compare, _Value>(__comp, __val); }
|
||||
|
||||
template<typename _Compare, typename _Iterator1>
|
||||
struct _Iter_comp_to_iter
|
||||
{
|
||||
_Compare _M_comp;
|
||||
typename geode::stl::iterator_traits<_Iterator1>::reference _M_ref;
|
||||
|
||||
_Iter_comp_to_iter(_Compare __comp, _Iterator1 __it1)
|
||||
: _M_comp(__comp), _M_ref(*__it1)
|
||||
{ }
|
||||
|
||||
template<typename _Iterator2>
|
||||
bool
|
||||
operator()(_Iterator2 __it2)
|
||||
{ return bool(_M_comp(*__it2, _M_ref)); }
|
||||
};
|
||||
|
||||
template<typename _Compare, typename _Iterator>
|
||||
inline _Iter_comp_to_iter<_Compare, _Iterator>
|
||||
__iter_comp_iter(_Iter_comp_iter<_Compare> __comp, _Iterator __it)
|
||||
{ return _Iter_comp_to_iter<_Compare, _Iterator>(__comp._M_comp, __it); }
|
||||
|
||||
template<typename _Predicate>
|
||||
struct _Iter_negate
|
||||
{
|
||||
_Predicate _M_pred;
|
||||
|
||||
_Iter_negate(_Predicate __pred)
|
||||
: _M_pred(__pred)
|
||||
{ }
|
||||
|
||||
template<typename _Iterator>
|
||||
bool
|
||||
operator()(_Iterator __it)
|
||||
{ return !bool(_M_pred(*__it)); }
|
||||
};
|
||||
|
||||
template<typename _Predicate>
|
||||
inline _Iter_negate<_Predicate>
|
||||
__negate(_Iter_pred<_Predicate> __pred)
|
||||
{ return _Iter_negate<_Predicate>(__pred._M_pred); }
|
||||
|
||||
} // namespace __ops
|
||||
} // namespace __gnu_cxx
|
||||
|
||||
#endif
|
|
@ -1,184 +0,0 @@
|
|||
// Pointer Traits -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2011-2014 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/ptr_traits.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{memory}
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
#include "c++config.h"
|
||||
|
||||
#include <type_traits>
|
||||
#define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \
|
||||
template<typename _Tp, typename = std::void_t<>> \
|
||||
struct __has_##_NTYPE \
|
||||
: std::false_type \
|
||||
{ }; \
|
||||
template<typename _Tp> \
|
||||
struct __has_##_NTYPE<_Tp, std::void_t<typename _Tp::_NTYPE>> \
|
||||
: std::true_type \
|
||||
{ };
|
||||
|
||||
namespace geode::stl {
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
_GLIBCXX_HAS_NESTED_TYPE(element_type)
|
||||
_GLIBCXX_HAS_NESTED_TYPE(difference_type)
|
||||
|
||||
template<typename _Tp, bool = __has_element_type<_Tp>::value>
|
||||
struct __ptrtr_elt_type;
|
||||
|
||||
template<typename _Tp>
|
||||
struct __ptrtr_elt_type<_Tp, true>
|
||||
{
|
||||
typedef typename _Tp::element_type __type;
|
||||
};
|
||||
|
||||
template<template<typename, typename...> class _SomePtr, typename _Tp,
|
||||
typename... _Args>
|
||||
struct __ptrtr_elt_type<_SomePtr<_Tp, _Args...>, false>
|
||||
{
|
||||
typedef _Tp __type;
|
||||
};
|
||||
|
||||
template<typename _Tp, bool = __has_difference_type<_Tp>::value>
|
||||
struct __ptrtr_diff_type
|
||||
{
|
||||
typedef typename _Tp::difference_type __type;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct __ptrtr_diff_type<_Tp, false>
|
||||
{
|
||||
typedef ptrdiff_t __type;
|
||||
};
|
||||
|
||||
template<typename _Ptr, typename _Up>
|
||||
class __ptrtr_rebind_helper
|
||||
{
|
||||
template<typename _Ptr2, typename _Up2>
|
||||
static constexpr std::true_type
|
||||
_S_chk(typename _Ptr2::template rebind<_Up2>*);
|
||||
|
||||
template<typename, typename>
|
||||
static constexpr std::false_type
|
||||
_S_chk(...);
|
||||
|
||||
public:
|
||||
using __type = decltype(_S_chk<_Ptr, _Up>(nullptr));
|
||||
};
|
||||
|
||||
template<typename _Tp, typename _Up,
|
||||
bool = __ptrtr_rebind_helper<_Tp, _Up>::__type::value>
|
||||
struct __ptrtr_rebind;
|
||||
|
||||
template<typename _Tp, typename _Up>
|
||||
struct __ptrtr_rebind<_Tp, _Up, true>
|
||||
{
|
||||
typedef typename _Tp::template rebind<_Up> __type;
|
||||
};
|
||||
|
||||
template<template<typename, typename...> class _SomePtr, typename _Up,
|
||||
typename _Tp, typename... _Args>
|
||||
struct __ptrtr_rebind<_SomePtr<_Tp, _Args...>, _Up, false>
|
||||
{
|
||||
typedef _SomePtr<_Up, _Args...> __type;
|
||||
};
|
||||
|
||||
template<typename _Tp, typename = typename std::remove_cv<_Tp>::type>
|
||||
struct __ptrtr_not_void
|
||||
{
|
||||
typedef _Tp __type;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct __ptrtr_not_void<_Tp, void>
|
||||
{
|
||||
struct __type { };
|
||||
};
|
||||
|
||||
template<typename _Ptr>
|
||||
class __ptrtr_pointer_to
|
||||
{
|
||||
typedef typename __ptrtr_elt_type<_Ptr>::__type __orig_type;
|
||||
typedef typename __ptrtr_not_void<__orig_type>::__type __element_type;
|
||||
|
||||
public:
|
||||
static _Ptr pointer_to(__element_type& __e)
|
||||
{ return _Ptr::pointer_to(__e); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Uniform interface to all pointer-like types
|
||||
* @ingroup pointer_abstractions
|
||||
*/
|
||||
template<typename _Ptr>
|
||||
struct pointer_traits : __ptrtr_pointer_to<_Ptr>
|
||||
{
|
||||
/// The pointer type
|
||||
typedef _Ptr pointer;
|
||||
/// The type pointed to
|
||||
typedef typename __ptrtr_elt_type<_Ptr>::__type element_type;
|
||||
/// Type used to represent the difference between two pointers
|
||||
typedef typename __ptrtr_diff_type<_Ptr>::__type difference_type;
|
||||
|
||||
template<typename _Up>
|
||||
using rebind = typename __ptrtr_rebind<_Ptr, _Up>::__type;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Partial specialization for built-in pointers.
|
||||
* @ingroup pointer_abstractions
|
||||
*/
|
||||
template<typename _Tp>
|
||||
struct pointer_traits<_Tp*>
|
||||
{
|
||||
/// The pointer type
|
||||
typedef _Tp* pointer;
|
||||
/// The type pointed to
|
||||
typedef _Tp element_type;
|
||||
/// Type used to represent the difference between two pointers
|
||||
typedef ptrdiff_t difference_type;
|
||||
|
||||
template<typename _Up>
|
||||
using rebind = _Up*;
|
||||
|
||||
/**
|
||||
* @brief Obtain a pointer to an object
|
||||
* @param __r A reference to an object of type @c element_type
|
||||
* @return @c addressof(__r)
|
||||
*/
|
||||
static pointer
|
||||
pointer_to(typename __ptrtr_not_void<element_type>::__type& __r) noexcept
|
||||
{ return std::addressof(__r); }
|
||||
};
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue