Browse Source

Implement screen shots

pull/44/head
Anders Jenbo 7 years ago
parent
commit
cc3abbe92c
  1. 19
      SourceX/dx.cpp
  2. 30
      SourceX/miniwin/misc.cpp
  3. 2
      SourceX/miniwin/misc_io.cpp

19
SourceX/dx.cpp

@ -222,7 +222,13 @@ class StubPalette : public IDirectDrawPalette {
};
virtual HRESULT GetEntries(DWORD dwFlags, DWORD dwBase, DWORD dwNumEntries, LPPALETTEENTRY lpEntries)
{
UNIMPLEMENTED();
for (int i = 0; i < dwNumEntries; i++) {
lpEntries[i].peFlags = 0;
lpEntries[i].peRed = system_palette[i].peRed;
lpEntries[i].peGreen = system_palette[i].peGreen;
lpEntries[i].peBlue = system_palette[i].peBlue;
}
return DVL_S_OK;
};
virtual HRESULT Initialize(LPDIRECTDRAW lpDD, DWORD dwFlags, LPPALETTEENTRY lpDDColorTable)
{
@ -230,7 +236,14 @@ class StubPalette : public IDirectDrawPalette {
};
virtual HRESULT SetEntries(DWORD dwFlags, DWORD dwStartingEntry, DWORD dwCount, LPPALETTEENTRY lpEntries)
{
UNIMPLEMENTED();
for (int i = 0; i < dwCount; i++) {
system_palette[i].peFlags = 0;
system_palette[i].peRed = lpEntries[i].peRed;
system_palette[i].peGreen = lpEntries[i].peGreen;
system_palette[i].peBlue = lpEntries[i].peBlue;
}
palette_update();
return DVL_S_OK;
};
};
@ -448,4 +461,4 @@ void dx_reinit()
UNIMPLEMENTED();
}
} // namespace dvl
} // namespace dvl

30
SourceX/miniwin/misc.cpp

@ -4,6 +4,8 @@
#include "stubs.h"
#include "dx.h"
#include "DiabloUI/diabloui.h"
#include <glob.h>
#include <string>
namespace dvl {
@ -405,15 +407,29 @@ void GetLocalTime(LPSYSTEMTIME lpSystemTime)
UNIMPLEMENTED();
}
long _findfirst(const char *, struct DVL_finddata_t *)
glob_t globbuf;
int _findfirsti;
/**
* @return The value is not unique, but the engine only users one at a time
*/
long _findfirst(const char *pattern, struct DVL_finddata_t *finder)
{
UNIMPLEMENTED();
return -1;
glob(pattern, 0, NULL, &globbuf);
_findfirsti = 0;
return _findnext(0, finder);
}
int _findnext(long, struct DVL_finddata_t *)
int _findnext(long, struct DVL_finddata_t *finder)
{
UNIMPLEMENTED();
while (_findfirsti < globbuf.gl_pathc) {
strncpy(finder->name, globbuf.gl_pathv[_findfirsti], DVL_MAX_PATH);
_findfirsti++;
return 0;
}
if (globbuf.gl_pathc > 0)
globfree(&globbuf);
return -1;
}
@ -583,7 +599,7 @@ DWORD GetCurrentProcessId()
}
HANDLE CreateFileMappingA(HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect,
DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCSTR lpName)
DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCSTR lpName)
{
UNIMPLEMENTED();
}
@ -621,7 +637,7 @@ DWORD GetPrivateProfileStringA(LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpDefa
strncpy(lpReturnedString, lpDefault, nSize);
SRegSaveString(lpAppName, lpKeyName, 0, lpReturnedString);
}
return 0; // dummy return value
return 0; // dummy return value
}
int MessageBoxA(HWND hWnd, const char *Text, const char *Title, UINT Flags)

2
SourceX/miniwin/misc_io.cpp

@ -28,7 +28,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
char name[DVL_MAX_PATH];
TranslateFileName(name, sizeof(name), lpFileName);
DUMMY_PRINT("file: %s (%s)", lpFileName, name);
UNIMPLEMENTED_UNLESS(dwDesiredAccess == (DVL_GENERIC_READ | DVL_GENERIC_WRITE));
UNIMPLEMENTED_UNLESS(!(dwDesiredAccess & ~(DVL_GENERIC_READ | DVL_GENERIC_WRITE)));
memfile* file = new memfile;
file->path = name;
if (dwCreationDisposition == DVL_OPEN_EXISTING) {

Loading…
Cancel
Save