Skip to content

unify(dx8wrapper): Merge zh dx8wrapper to generals dx8wrapper part 1 #1423

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ryan-de-boer
Copy link

@ryan-de-boer ryan-de-boer commented Aug 5, 2025

Some of zh dx8wrapper has been merged to the generals dx8wrapper.

Redoing this pull request: #1401
Small amounts at a time for easier review.

@xezon xezon added Gen Relates to Generals Unify Unifies code between Generals and Zero Hour labels Aug 6, 2025
Copy link

@xezon xezon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently this change has a lot of incorrect white space changes which

  1. Make the diff larger than necessary
  2. Make the format different to Zero Hour

When merging from Zero Hour to Generals, please preserve the formatting of Zero Hour. This will make reviewing and diffing easier.

@@ -115,7 +115,8 @@ class TextureFilterClass
void Set_V_Addr_Mode(TxtAddrMode mode) { VAddressMode=mode; }

// This needs to be called after device has been created
static void _Init_Filters(void);
static void _Init_Filters(TextureFilterMode texture_filter);
static void _Init_Filters();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are there 2 functions now?

Zero Hour just has 1.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its because other general files are still calling the old function, and we wanted this commit to be small. I'll investigate and see how big the diff will be.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok. Then that makes sense.

DX8Wrapper::Set_Transform(D3DTS_VIEW,old_view);
DX8Wrapper::Set_Transform(D3DTS_WORLD,old_world);
DX8Wrapper::Set_Transform(D3DTS_VIEW, old_view);
DX8Wrapper::Set_Transform(D3DTS_WORLD, old_world);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This formatting does not match Zero Hour. If you copy & paste code, disable the auto format feature in your IDE to preserve the original format on copy & paste. Otherwise use WinMerge or similar to merge the code correctly with all identical formatting.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea to change the IDE. I always have trouble with that. I do ctrl paste, undo which usually undoes the formatting but I don't think it always works. Could also use the merge tool.

@ryan-de-boer
Copy link
Author

@xezon could you review the code review changes?

@OmniBlade
Copy link

Looks like the branch has merge conflicts, you need to rebase on latest main?

@xezon
Copy link

xezon commented Aug 8, 2025

Looks like the branch has merge conflicts, you need to rebase on latest main?

Yes. Try apply white space changes with scripts/cpp/remove_trailing_whitespace.py before merging if there are to many merge conflicts otherwise.

@xezon
Copy link

xezon commented Aug 12, 2025

This review now claims to have touched 3800 files.

@ryan-de-boer ryan-de-boer requested a review from OmniBlade August 13, 2025 10:56
@ryan-de-boer
Copy link
Author

ryan-de-boer commented Aug 13, 2025

[fixed] force push removed the in between commits by others.

This review now claims to have touched 3800 files.

Maybe a rebase was the wrong strategy? It seems to have included all commits on main between my commits and the rebased commit? Should I redo the whole pull request with just my 5 commits?

@ryan-de-boer
Copy link
Author

ryan-de-boer commented Aug 13, 2025

[fixed] nevermind I missed the force push and it ended up commits by others.

Looks like the branch has merge conflicts, you need to rebase on latest main?

Can you do a rebase without including all the in between commits in github pull request? The pull request seems to now have 18 more commits than expected.
Would a pull be better than rebase? But that might include lots of unwanted changes in a merge commit...

@Stubbjax
Copy link

Can you do a rebase without including all the in between commits in github pull request? The pull request seems to now have 18 more commits than expected. Would a pull be better than rebase? But that might include lots of unwanted changes in a merge commit...

All a rebase with main should do is effectively undo all your commits, fast-forward your branch to the latest commit on main, and then reapply your commits as if that's where you had originally branched from. You should not see any commits from other branches or main in the diff.

image

I'm not sure what you've done but a simple solution would be to checkout latest main, cherry-pick each of your commits from this branch chronologically and then force-push the changes to the same remote branch. (Basically a manual rebase.)

@ryan-de-boer
Copy link
Author

I'm not sure what you've done but a simple solution would be to checkout latest main, cherry-pick each of your commits from this branch chronologically and then force-push the changes to the same remote branch. (Basically a manual rebase.)

Thanks for this. I was missing a force-push, that's why it kept the old commits. All I had to do was point my branch to "Fix Makefile merge" (the last commit I want in the pull request) and force-push and the pull request fixed itself. I'm glad I didn't need to create another one.

Copy link

@xezon xezon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make a pass on the whitespace differences. You can run the scripts/cpp/remove_trailing_whitespace.py script to help with that.

Also please double check that code has been merged to the right places. I commented a few that are not placed correctly.

@@ -732,6 +739,7 @@ void SortingRendererClass::Flush()

}


Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zero Hour does not have this blank line

Matrix4x4 old_view;
Matrix4x4 old_world;
DX8Wrapper::Get_Transform(D3DTS_VIEW,old_view);
DX8Wrapper::Get_Transform(D3DTS_WORLD,old_world);

while (SortingNodeStruct* state=sorted_list.Head()) {
state->Remove();

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zero Hour does not have these tabs

@@ -459,6 +462,8 @@ class DX8Wrapper
static void Set_Vertex_Shader_Constant(int reg, const void* data, int count);
static void Set_Pixel_Shader_Constant(int reg, const void* data, int count);

static ZTextureClass* Shadow_Map[MAX_SHADOW_MAPS];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is placed at the wrong location.

@@ -100,6 +100,8 @@ class TextureClass;
class LightClass;
class SurfaceClass;

class ZTextureClass;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is supposed to be before class SurfaceClass

@@ -2406,7 +2473,7 @@ IDirect3DSurface8 * DX8Wrapper::_Create_DX8_Surface(const char *filename_)
strncpy(compressed_name,filename_, ARRAY_SIZE(compressed_name));
compressed_name[ARRAY_SIZE(compressed_name)-1] = '\0';
char *ext = strstr(compressed_name, ".");
if ( ext && (strlen(ext)==4) &&
if ( ext && (strlen(ext)==4) &&
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zero Hour does not have this whitespace

#define SHD_INIT_SHADERS
#define SHD_SHUTDOWN_SHADERS
#define SHD_FLUSH
#define SHD_REG_LOADER
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are whitespace changes that are not supposed to be here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gen Relates to Generals Unify Unifies code between Generals and Zero Hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants