-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Meta Issue] Cleanup codebase #15
Comments
A rough approximation of issues that exist or could be introduced from this issue.
|
Comments above the license is janky too. |
It's worth remembering this was written nearly ~20 years ago while the system was being researched. Such code is often hastily written, at the expense of good software engineering practice :) It sounds like you already know how the code should look. If you want to fix this tool and make it the ultimate XBE parsing and manipulation library/tool, you are welcome to. Send PRs and I'll review them when I can; although I must warn you, review wait times can be long. You are also free to just scrap the majority of it and start from scratch on a new thing. Frankly, this is what I would suggest, and have done before: https://github.com/mborgerson/pyxbe. I prefer to write my tools in Python, but there are certainly use cases for a native version. If you do choose to continue working a native version, the headers are useful, the rest can be trivially re-written using existing code as reference. There is also XBE parsing/writing stuff in CXBE (perhaps the best native XBE tool, minus signing), Cxbx-Reloaded, XbSymbolDatabase etc. that you can work with. There is also a Ghidra extension ghidra-xbe that you can use for reversing. I suggest joining the XboxDev Discord server where you can discuss your ideas with community/maintainers. |
Cool beans. I'd like something in I'll hop on the discord at some point to say hi! |
This began as a question in response to #7 but it went so far off the rails that I figured I'd open a meta-issue.
In regards to #7
Several lines that need whitespace fixes are commented out code. IMO, that's something that should rarely be seen in a
master
branch. Can we delete the unimportant lines of commented code (probably all) while we're at it? Even comments like this are useless:I can use ctags to figure out what
xorentry
does faster than I can overlook the casting, figure out what line of actual code this comment is referring to, and ask why myself why I care.Sub-issues of codebase cleanup
Then there are commented out
printf
statements. Perhaps we still want these, but only in debug builds? Only with a verbose flag specified? My vote is forDEBUG
,WARN
, andERROR
print macros. With__LINE__
indicators!Speaking of
ERROR
, I see a good many places where return values are ignored. The codebase should be audited to ensure return values are checked. There are more, but I'm looking at:All sorts of flags are not using definitions.
What does this mean? Let's use the constants.
Formatting styles are mixed.
xbestructure.h
looks like someone pulled these structures from debug symbols or something. How aboutstruct _XBE_HEADER
->struct xbe_header
... and so on for all structs and members.The comments in
xbestructure.h
destroy my eyes and make it impossible to see what the structure looks like. Lets inline the comments, and align the comments to the same x-coordinate (first 4 space tab alignment after the member with the longest name). Some of these might run over 80 chars but we can do multi-line, not care, or take suggestions.The comments in
xbestructure.h
don't need offsets. I'll useoffsetof
if I care.In
xbestructure.h
, member names should be based and commented on some reputable source. I remember usingcaustik
's website in the past. There was one piece of errata, but I can't seem to find their site anymore :(https://xboxdevwiki.net/Xbe
instead?Some of the comments in
xbestructure.h
are questions. Others are references to dead websites. Some of the time, it seems like they couldn't decide which data type to use.int32_t num_libraries
pc_exe_...
off_t
to aconst char *
maybe?uint32_t
was ultimately used. I do seem to remember these being offsets. If they are, I vote that they are change tooff_t
data types.I like to avoid
typedef
s and this is a small codebase. We can deal with writingstruct
a couple more times to make it blatantly obvious that we are working with structures we have defined ourselves.I'd prefer
#define
s be at the top of headers, beneath the includes.Some headers seem stretched to include things that don't belong there.
xbestructure.h
)void shax(...)
-- Nope. This one is about the structure of XBEsxbe.h
.structure
seems redundant. When you're working with Linuxelf
files, you getelf.h
. I like that. It's simple.xbe.h
.Dockerize the build? Document the build? Scuba da build?
The existing readme is cool and I am in full support of recognizing the original author. Maybe a better readme is introduced that acknowledges and links to original author / readme?
I have more to add, but I'd like a ping from a maintainer to know that this is even worth my time. I'll happily get some issues and PRs out once I know that this project is actively maintained!
Whipped in to shape, this could be not only a good utility, but a good library... which is the primary reason I'm eager to get some PRs in. A good XBE manipulation library is solid start to a permanent (or runtime) hook injection utility. With such hooks, I can inject start and stop points (Or create loops to eliminate snapshot reload time) for a kernel fuzzer I've been developing. They could also just be silly fun :D
I'm very excited to use the library I'm envisioning so hit me back at your earliest convenience!
The text was updated successfully, but these errors were encountered: