Commit Graph

87 Commits

Author SHA1 Message Date
Sandy Carter
3c3709dbe7 [CPU] Use c++ style cast 2019-08-14 06:42:30 -05:00
Jonathan Goyvaerts
c1af632562 Replace all gflag implementations with cvar implementations 2019-08-03 02:34:07 +02:00
gibbed
5f764fc752 [CPU] Move LZX code to its own files. 2018-11-24 15:02:03 -06:00
gibbed
dd3a049b23 [CPU] Oops. 2018-11-24 15:00:00 -06:00
gibbed
207589e5a1 [CPU/Kernel] Correct parsing of XEX_HEADER_IMPORT_LIBRARIES. 2018-11-24 04:05:41 -06:00
gibbed
7226c9e047 Update mspack, add to premake, and fix missing license. Fixes #1252. 2018-11-23 15:32:55 -06:00
emoose
ab53cf2a82 [CPU] Fix some compressed XEXs decompressing past the image size 2018-11-05 19:47:18 +00:00
emoose
bbb5c938ec [CPU] Fix XexModule::FindSaveRest not finding functions properly 2018-11-01 15:50:56 +00:00
Dr. Chat
7443b7e61f [CPU] Rename ImportLibrary fields to follow naming conventions 2018-10-28 09:41:31 -05:00
emoose
6e74ba93d6 [CPU] Add support for delta patches using *_offset fields 2018-10-22 12:26:14 +01:00
emoose
d2fd109af3 [CPU] Add more asserts for XEXP descriptor (+ log a warning) 2018-10-20 05:08:14 +01:00
emoose
265903fe66 [CPU] Add XEXP support to XexModule, if XEXP is in same folder as XEX
This was a headache to work out, big thanks to the lack of documentation on .xexp files... a ton of guesswork was involved here but luckily it turned out well.

I did have to make some pretty major changes to the way XEX files are loaded though.
Previously it'd just load everything in one go: XEX headers -> decrypt/decompress data -> load imports/symbols -> set loader data table entries, etc...

Now it's changed to something like this:
- Load base XEX headers + decrypted/decompressed image data, return X_STATUS_PENDING
- In the LoadFromFile call used to load the XEX, search for XEXP patch file (only .xexp in same folder atm)
- If patch exists: load XEXP, decrypt headers/data, apply patch to base XEX, dispose of XEXP
- Finish XEX load via LoadXexContinue() (handles imports/symbols/loader data...)

This saves us from needing to reset the imports/function/symbol stuff after patching (since all the XEX code will be a lot different), but I'm not really sure if I went about it the best way.
2018-10-20 04:36:21 +01:00
emoose
0b7f7e1657 [CPU] Move XEX2 code into XexModule class, autodetect XEX key
Code is mainly just copy/pasted from kernel/util/xex2.cc, I've tried fixing it up to work better in a class, but there's probably some things I missed.

Also includes some minor improvements to the XEX loader, like being able to try both XEX keys (retail/devkit) automatically, and some fixes to how the base address is determined.

(Previously there was code that would get base address from optional header, code that'd get it from xex_security_info, code that'd use a stored base address value...
Now everything reads it from a single stored value instead, which is set either from the xex_security_info, or if it exists from the optional header instead.
Maybe this can help improve compatibility with any weird XEX's that don't have a base address optional header?)

Compressed XEX loader also has some extra checks to make sure the compressed data hash matches what's expected.
Might increase loading times by a fraction, but could save reports from people unknowingly using corrupt XEXs.
(still no checks for non-compressed data though, maybe need to compare data with xex_security_info->ImageHash?)
2018-10-20 04:18:18 +01:00
Dr. Chat
ad5748f3e7 Handle cases where the optional import header isn't present :P 2017-02-25 20:28:45 -06:00
Ben Vanik
9473f20c7f Fixing travis lint diff. 2016-01-13 22:55:28 -08:00
Dr. Chat
36372d1eae Enforce xex memory protections 2016-01-13 01:47:06 -06:00
Ben Vanik
86b706d87c Merge pull request #509 from x1nixmzeng/xex-resources
Rebrand the Xenia window with module metadata
2016-01-10 08:55:47 -08:00
x1nixmzeng
3eb602c93a Assert library name index is in range of the string table
As suggested by @DrChat
2016-01-09 17:55:57 +00:00
x1nixmzeng
6530b9dc49 Added callback when new module is launched
This avoids having to guess the display window title format
Also manually fixed the linting errors picked out by travis which do not
get picked up using xb format locally
2016-01-09 17:36:46 +00:00
x1nixmzeng
06f259c87d Mask the name index instead
The maximum number of import libraries (32) is already asserted
2016-01-09 02:43:29 +00:00
x1nixmzeng
7e4fdf7669 Fixed rare crash when accessing library import by name
The library name index may only be 8-bits.

This bug was not present in the previous implementation due to a bitmask
(0xFF) - see
ea99ba8e3b/src/xenia/kernel/util/xex2.cc (L272)
2016-01-09 01:19:05 +00:00
Ben Vanik
948aa2400d Formatting all code. Too gnarly to rebase properly. 2015-12-29 13:13:34 -08:00
Dr. Chat
db8eb83057 Track export data on Guest Functions 2015-12-29 12:32:47 -08:00
Ben Vanik
0e58208add Dropping elemental-forms and swapping out with imgui.
Too much code for such little use. This should simplify porting.
2015-12-26 20:25:24 -08:00
Ben Vanik
15816327b4 Renaming xe::cpu::frontend to xe::cpu::ppc. 2015-12-14 21:17:55 -08:00
Dr. Chat
57a823ae39 Add (commented out) code to setup page protections for xex modules. 2015-12-01 19:53:17 -06:00
Ben Vanik
e5fbf840d2 Shuffling kernel/. 2015-09-06 18:07:52 -07:00
Ben Vanik
b80a028589 Much better errors on undefined externs. 2015-08-30 15:27:12 -07:00
Ben Vanik
87094b8257 Adding XamUserContentRestriction* functions. 2015-08-30 15:00:04 -07:00
Dr. Chat
d2f672b2c5 Shift export ordinal back by the base to avoid false positive error 2015-08-14 20:02:39 -05:00
Ben Vanik
a92566dfc5 More style. 2015-08-07 21:29:03 -07:00
Ben Vanik
5e08889d93 More style cleanup. 2015-08-06 20:17:01 -07:00
Ben Vanik
eaa1a8ee3a Refactoring SymbolInfo/FunctionInfo/Function into Symbol/Function. 2015-08-05 21:50:02 -07:00
Ben Vanik
12a29371e3 Clang fixes. 2015-07-19 18:32:48 -07:00
Ben Vanik
5c7f42e9d1 Fix for unknown kernel modules. 2015-07-19 10:55:12 -07:00
Ben Vanik
91d7acf59e Fixing some particularly bad /W4. 2015-07-18 23:04:21 -07:00
Dr. Chat
f9977a25af Use std::vector to hold the xex header instead of new/delete 2015-07-06 19:45:10 -05:00
Dr. Chat
93f24d2047 XexModule keep track of whether it's loaded into memory or not 2015-07-06 10:40:35 -05:00
Dr. Chat
4e6b036b3c Formatting. 2015-07-05 16:28:11 -05:00
Dr. Chat
567bb525f8 Fix incorrectly getting the exe address 2015-07-05 15:41:47 -05:00
Dr. Chat
7f53b1d630 Allow unloading of user modules 2015-07-05 14:03:00 -05:00
Dr. Chat
1788ee1589 Linting. 2015-07-03 20:11:08 -05:00
Dr. Chat
03ffb20a43 Warn when importing an unimplemented kernel function 2015-07-03 19:44:11 -05:00
Dr. Chat
b852ce75df Write a dummy value into unresolved import variables. 2015-07-03 19:00:07 -05:00
Dr. Chat
e58bb5ad9f ReImplement XexModule::GetProcAddress 2015-07-03 18:29:14 -05:00
Dr. Chat
d616231c8b Trigger a PPC debug trap if an unresolved import is called. 2015-07-03 18:03:33 -05:00
Dr. Chat
0211135fd6 Fix potential corruption for GetOptHeader 2015-07-03 10:41:43 -05:00
Dr. Chat
362a521c79 Rewrite XexModule to drop dependency on old xex2 headers for imports 2015-07-03 08:17:23 -05:00
Dr. Chat
029babaf5d Drop dependency on old-style xex2 headers 2015-07-03 08:15:53 -05:00
Dr. Chat
fe87c08424 Shuffle some code around. 2015-07-03 08:15:53 -05:00