Skip to content
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

Some Fixes #81

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Draft

Some Fixes #81

wants to merge 15 commits into from

Conversation

4z0t
Copy link
Member

@4z0t 4z0t commented Aug 5, 2024

  • Add string dtor. Before that calling CopyToClipboard with long strings was causing memory leak;
  • Fix for SetStat is now pure asm;
  • Proper engine string declaration. Before that they were declared as pointers and implying that could be changed. Now they are of array type;
  • Proper address for string s_UnknownColor.
  • Add definition for VMatrix4 ,CD3DPrimBatcher and GeomCamera
  • fix definitions of CHeightField, STIMap, CMauiControl and CMauiBitmap

Copy link
Collaborator

@Hdt80bro Hdt80bro left a comment

Choose a reason for hiding this comment

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

Fill in those structs!

Comment on lines +197 to +223
struct CMauiControl : CScriptObject //ctor 0x007867B0
{//0x004C6F8A, 0x11C bytes
using Type = ObjectType<0x10C7700, 0xF83314>;

void *unk1;
void *unk2;
CMauiControl *parent;
void *unk3;
void *unk4;
LuaObject left;
LuaObject right;
LuaObject top;
LuaObject bottom;
LuaObject width;
LuaObject height;
LuaObject depth;
float f_depth;
void *field_D8;
void *field_DC;
void *field_E0;
void *field_E4;
bool flags[8];
float field_F0;
int unk5;
void *unk6;
void *unk7;
string name;
Copy link
Collaborator

Choose a reason for hiding this comment

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

struct intrusive_linked_list_cmauicontrol {
  intrusive_linked_list_cmauicontrol *list_next;
  intrusive_linked_list_cmauicontrol *nextControl;
}

struct CMauiControl : CScriptObject, intrusive_linked_list_cmauicontrol
{
  CMauiControl *parent;
  intrusive_linked_list_cmauicontrol childrenLinkedList;
  LuaObject leftLV;
  LuaObject rightLV;
  LuaObject topLV;
  LuaObject bottomLV;
  LuaObject widthLV;
  LuaObject heightLV;
  LuaObject depthLV;
  float depth;
  fastvector<CMauiControl*> renderedChildren;
  bool invalidated;
  bool hitTest;
  bool isHidden;
  bool needsFrameUpdate;
  bool invisible;
  float alpha;
  unsigned int alphaMask;
  int renderPass;
  CMauiFrame *rootFrame;
  string debugName;
};

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no fastvector defined.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's basically

template<class T>
struct gpg::fastvector  {
  gpg::fastvector<T>* self; // likely an unused instrusive singly linked list
  std::vector<T> vec;
}

It's easy to tell when it's being used because it has 4 members instead of the 3 vector has, so its starting pointer is in the second field instead of the first.

bool field_170[4];
void *unk_[6];
};
VALIDATE_SIZE(CMauiBitmap, 0x18C)
Copy link
Collaborator

Choose a reason for hiding this comment

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

struct CMauiBitmap : CMauiControl
{
  fastvector<WeakPtr<CD3DBatchTexture>> textureBatches;
  LuaObject bitmapWidthLV;
  LuaObject bitmapHeightLV;
  float u0;
  float v0;
  float u1;
  float v1;
  BitArray2D *hitMask;
  bool useAlphaHitTest;
  bool isTiled;
  float frameRate;
  bool isPlaying;
  bool doLoop;
  int curFrame;
  float curFrameTime;
  fastvector<int> framePattern;
};

Comment on lines +1524 to +1536
struct CD3DPrimBatcher //0x007F6BD0 292 bytes
{
void* textureBatcher;
int pad1[22];
VMatrix4 viewMatrix;
VMatrix4 projectionMatrix;
VMatrix4 unknownMatrix;
bool b1;
bool b2;
bool padb1;
bool padb2;
int unk;
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

struct CD3DPrimBatcher
{
  CD3DTextureBatcher *texBatcher;
  CD3DVertexSheet *vertexSheets[3];
  int curVertexSheet;
  CD3DIndexSheet *indexSheet;
  fastvector<CD3DPrimBatcher::Vertex> vertices;
  fastvector<short> primitives;
  int mode;
  WeakPtr<CD3DDynamicTextureSheet> tex1;
  WeakPtr<CD3DBatchTexture> batchTexture;
  Vector2f p2;
  Vector2f p1;
  VMatrix4 viewMatrix;
  VMatrix4 projectionMatrix;
  VMatrix4 composite;
  bool resetComposite;
  bool rebuildComposite;
  float alphaMultiplier;
};

section/include/moho.h Outdated Show resolved Hide resolved
section/include/moho.h Outdated Show resolved Hide resolved
* CGeomCamera3
* CGeomSolid3
* add moho_entity_set
* add vector_inline
@4z0t 4z0t marked this pull request as draft September 6, 2024 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants