-
Notifications
You must be signed in to change notification settings - Fork 93
Added various features #655
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
bd30f4b
2f0deb5
c0a40d6
b62a0ae
fc892e7
25c32e4
e13a346
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,8 @@ int main(int argc, char *argv[]) | |
|
|
||
| bool bRetail; | ||
| uint32 dwTitleId = 0xFFFF0002; | ||
| uint32 dwRegions; | ||
| uint32 dwRegions = XBEIMAGE_GAME_REGION_NA | XBEIMAGE_GAME_REGION_JAPAN | | ||
| XBEIMAGE_GAME_REGION_RESTOFWORLD | XBEIMAGE_GAME_REGION_MANUFACTURING; | ||
| uint32 dwVersion; | ||
|
|
||
| const char *program = argv[0]; | ||
|
|
@@ -91,7 +92,7 @@ int main(int argc, char *argv[]) | |
| { | ||
| char titlechar[2]; | ||
| unsigned titleno; | ||
|
Comment on lines
+93
to
+94
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using a not explicitly unsigned char can lead to incorrect results when shifting, better use the types defined in
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will adding |
||
| if (sscanf(szXbeTitleID, "%c%c-%u", &titlechar[0], &titlechar[1], &titleno) != 3) | ||
| if(sscanf(szXbeTitleID, "%c%c-%u", &titlechar[0], &titlechar[1], &titleno) != 3) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This formatting change does not belong here. |
||
| { | ||
| strncpy(szErrorMessage, "invalid TITLEID", ERROR_LEN); | ||
| goto cleanup; | ||
|
|
@@ -192,8 +193,8 @@ int main(int argc, char *argv[]) | |
| LogoPtr = &logo; | ||
| } | ||
|
|
||
| Xbe *XbeFile = | ||
| new Xbe(ExeFile, szXbeTitle, dwTitleId, dwRegions, dwVersion, bRetail, LogoPtr, szDebugPath); | ||
| Xbe *XbeFile = new Xbe( | ||
| ExeFile, szXbeTitle, dwTitleId, dwRegions, dwVersion, bRetail, LogoPtr, szDebugPath); | ||
|
Comment on lines
+196
to
+197
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This formatting change does not belong here. |
||
|
|
||
| if(XbeFile->GetError() != 0) | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,8 @@ static size_t BasenameOffset(const std::string &path) | |
|
|
||
| // construct via Exe file object | ||
| Xbe::Xbe(class Exe *x_Exe, const char *x_szTitle, uint32 x_dwTitleID, uint32 x_dwRegions, | ||
| uint32 x_dwVersion, bool x_bRetail, const std::vector<uint08> *logo, const char *x_szDebugPath) | ||
| uint32 x_dwVersion, bool x_bRetail, const std::vector<uint08> *logo, | ||
| const char *x_szDebugPath) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This formatting change does not belong here. |
||
| { | ||
| ConstructorInit(); | ||
|
|
||
|
|
@@ -394,7 +395,11 @@ Xbe::Xbe(class Exe *x_Exe, const char *x_szTitle, uint32 x_dwTitleID, uint32 x_d | |
| (characteristics & IMAGE_SCN_CNT_CODE)) | ||
| m_SectionHeader[v].dwFlags.bExecutable = true; | ||
|
|
||
| m_SectionHeader[v].dwFlags.bPreload = true; | ||
| char *name = (x_Exe->m_SectionHeader_longname[v].m_longname) | ||
| ? x_Exe->m_SectionHeader_longname[v].m_longname | ||
| : (char *)x_Exe->m_SectionHeader[v].m_name; | ||
| m_SectionHeader[v].dwFlags.bPreload = | ||
| (strcmp(name, ".debug") && strncmp(name, ".debug_", 7)); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It could be user generated. I only did it for completeness and it's not like it would hurt performance terribly. The more performance-oriented option would be to check if the first 6 matched
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The dot prefix is reserved. I don't care about performance here as much as clean code. |
||
| } | ||
|
|
||
| m_SectionHeader[v].dwVirtualAddr = | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,8 @@ class Xbe : public Error | |
| public: | ||
| // construct via Exe file object | ||
| Xbe(class Exe *x_Exe, const char *x_szTitle, uint32 x_dwTitleID, uint32 x_dwRegions, | ||
| uint32 x_dwVersion, bool x_bRetail, const std::vector<uint08> *logo = nullptr, const char *x_szDebugPath = nullptr); | ||
| uint32 x_dwVersion, bool x_bRetail, const std::vector<uint08> *logo = nullptr, | ||
| const char *x_szDebugPath = nullptr); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This formatting change does not belong here. |
||
|
|
||
| // deconstructor | ||
| ~Xbe(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably belongs into the commit that introduced being able to specify the region flags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah more leftovers from the incinerated commit