mirror of
https://github.com/isledecomp/isle-portable.git
synced 2024-11-22 07:28:00 -05:00
Initial implementation of MxBitmap (#34)
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
This commit is contained in:
parent
e929d76f3c
commit
428b5ae8db
2 changed files with 67 additions and 9 deletions
|
@ -3,25 +3,72 @@
|
|||
// OFFSET: LEGO1 0x100bc980
|
||||
MxBitmap::MxBitmap()
|
||||
{
|
||||
// TODO
|
||||
this->m_info = NULL;
|
||||
this->m_bmiHeader = NULL;
|
||||
this->m_paletteData = NULL;
|
||||
this->m_data = NULL;
|
||||
this->m_unk18 = FALSE;
|
||||
this->m_palette = NULL;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100bca10
|
||||
MxBitmap::~MxBitmap()
|
||||
{
|
||||
// TODO
|
||||
if (this->m_info != NULL) {
|
||||
delete m_info;
|
||||
}
|
||||
if (this->m_data != NULL) {
|
||||
delete m_data;
|
||||
}
|
||||
if (this->m_palette != NULL) {
|
||||
delete m_palette;
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100bd1c0
|
||||
MxPalette *MxBitmap::CreatePalette()
|
||||
{
|
||||
// TODO
|
||||
return NULL;
|
||||
// FIXME: This function needs MxPalette to be completed. Also INFERRING usage of MxBool
|
||||
MxPalette *pal = NULL;
|
||||
MxPalette *ppal;
|
||||
MxBool success = FALSE;
|
||||
|
||||
if(this->m_unk18 == FALSE) {
|
||||
// ppal = MxPalette::FromBitmapPalette(this->m_paletteData);
|
||||
} else {
|
||||
if(this->m_unk18 != TRUE) {
|
||||
if(!success && pal != NULL) {
|
||||
delete pal;
|
||||
pal = NULL;
|
||||
}
|
||||
}
|
||||
//.pal = MxPalette::Clone(this->m_palette);
|
||||
}
|
||||
if(pal != NULL) {
|
||||
success = TRUE;
|
||||
}
|
||||
|
||||
return pal;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100bcd10
|
||||
long MxBitmap::Read(const char *)
|
||||
long MxBitmap::Read(const char *filename)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
HANDLE handle;
|
||||
int unk1;
|
||||
MxResult ret = FAILURE;
|
||||
|
||||
handle = CreateFileA(filename,GENERIC_READ,FILE_SHARE_READ,(LPSECURITY_ATTRIBUTES)NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,(HANDLE)NULL);
|
||||
if(handle != (HANDLE)INVALID_HANDLE_VALUE) { // INVALID_HANDLE_VALUE = -1, or 0xffffffff
|
||||
// FIXME: line 16. iVar gets changed in this line
|
||||
if(unk1 == 0) {
|
||||
ret = SUCCESS;
|
||||
}
|
||||
}
|
||||
if(handle != (HANDLE)NULL) {
|
||||
CloseHandle(handle);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,26 @@
|
|||
#ifndef MXBITMAP_H
|
||||
#define MXBITMAP_H
|
||||
|
||||
#include "mxpalette.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
class MxBitmap
|
||||
#include "mxcore.h"
|
||||
#include "mxpalette.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
class MxBitmap : public MxCore
|
||||
{
|
||||
public:
|
||||
__declspec(dllexport) MxBitmap();
|
||||
__declspec(dllexport) virtual ~MxBitmap();
|
||||
__declspec(dllexport) virtual MxPalette *CreatePalette();
|
||||
__declspec(dllexport) virtual long Read(const char *);
|
||||
private:
|
||||
BITMAPINFO *m_info;
|
||||
BITMAPINFOHEADER *m_bmiHeader;
|
||||
RGBQUAD *m_paletteData;
|
||||
LPVOID *m_data;
|
||||
MxBool m_unk18;
|
||||
MxPalette *m_palette;
|
||||
};
|
||||
|
||||
#endif // MXBITMAP_H
|
||||
|
|
Loading…
Reference in a new issue