21 if (sscanf(p_deviceId,
"%d 0x%x 0x%x 0x%x 0x%x", &num, &hex[0], &hex[1], &hex[2], &hex[3]) != 5) {
30 memcpy(&guid, hex,
sizeof(guid));
53 static_assert(
sizeof(
GUID4) ==
sizeof(GUID),
"Equal size");
56 memcpy(&deviceGuid, &p_guid,
sizeof(
GUID4));
58 for (list<MxDriver>::iterator it =
m_list.begin(); it !=
m_list.end(); it++, i++) {
59 if (p_deviceNum >= 0 && p_deviceNum < i) {
65 for (list<Direct3DDeviceInfo>::iterator it2 = driver.
m_devices.begin(); it2 != driver.
m_devices.end(); it2++) {
71 if (GUID4::Compare(compareGuid, deviceGuid) && i == p_deviceNum) {
93 for (list<MxDriver>::iterator it =
m_list.begin(); it !=
m_list.end(); it++) {
96 for (list<Direct3DDeviceInfo>::iterator it2 = p_driver->
m_devices.begin(); it2 != p_driver->
m_devices.end();
98 if (i == p_deviceNum) {
115 assert(p_ddInfo && p_d3dInfo);
117 for (list<MxDriver>::const_iterator it =
m_list.begin(); it !=
m_list.end(); it++, number++) {
118 if (&(*it) == p_ddInfo) {
140 for (list<MxDriver>::iterator it =
m_list.begin(); it !=
m_list.end(); it++, i++) {
142 for (list<Direct3DDeviceInfo>::iterator it2 = driver.
m_devices.begin(); it2 != driver.
m_devices.end(); it2++) {
176 for (list<MxDriver>::iterator it =
m_list.begin(); it !=
m_list.end(); it++, i++) {
179 for (list<Direct3DDeviceInfo>::iterator it2 = driver.
m_devices.begin(); it2 != driver.
m_devices.end(); it2++) {
180 if ((*it2).m_HWDesc.dcmColorModel) {
184 if (cpu_mmx && (*it2).m_HELDesc.dcmColorModel ==
D3DCOLOR_RGB && i == 0) {
187 else if ((*it2).m_HELDesc.dcmColorModel ==
D3DCOLOR_MONO && i == 0 && k < 0) {
210 mov eax, 0x0 ; EAX=0: Highest Function Parameter and Manufacturer ID
217 mov eax, 0x1 ; EAX=1: Processor Info and Feature Bits (unused)
224 xor eax, eax ; Zero EAX
register
225 bt edx, 0x17 ; Test bit 0x17 (23): MMX instructions (64-bit SIMD) (Store in CF)
226 adc eax, eax ; Add with carry: EAX = EAX + EAX + CF = CF
228 mov supports_mmx, eax ; Save eax into C variable
231 __asm__(
"movl $0x0, %%eax\n\t"
233 "mov $0x1, %%eax\n\t"
235 "xorl %%eax, %%eax\n\t"
236 "btl $0x15, %%edx\n\t"
255 xor eax, eax ; Zero EAX
register
256 pushfd ; Push EFLAGS
register value on the
stack
257 or dword ptr[esp], 0x200000 ;
Set bit 0x200000: Able to use CPUID instruction (Pentium+)
258 popfd ; Write the updated value into the EFLAGS
register
259 pushfd ; Push EFLAGS
register value on the
stack (again)
260 btr dword ptr[esp], 0x15 ; Test bit 0x15 (21) and reset (
set CF)
261 adc eax, eax ; Add with carry: EAX = EAX + EAX + CF = CF
262 popfd ; Push EFLAGS
register value on the
stack (again, and makes sure the
stack remains the same)
263 mov has_cpuid, eax ; Save eax into C variable
272 __asm__(
"xorl %%eax, %%eax\n\t"
274 "orl $0x200000, (%%esp)\n\t"
277 "btrl $0x15, (%%esp)\n\t"
278 "adc %%eax, %%eax\n\t"
282#elif defined(__x86_64__) || defined(__amd64__)
300 for (list<MxDriver>::iterator it =
m_list.begin(); it !=
m_list.end();) {
308 for (list<Direct3DDeviceInfo>::iterator it2 = driver.
m_devices.begin(); it2 != driver.
m_devices.end();) {
339 if ((*it).m_width == 640 && (*it).m_height == 480) {
340 if ((*it).m_bitsPerPixel == 8 || (*it).m_bitsPerPixel == 16) {
369 for (list<Direct3DDeviceInfo>::iterator it = front.
m_devices.begin(); it != front.
m_devices.end(); it++) {
370 if ((&*it) == &p_device) {
static int SupportsCPUID()
[AI] Checks if the CPU supports CPUID instruction.
unsigned char DriverSupportsRequiredDisplayMode(MxDriver &p_driver)
[AI] Checks if a driver supports a 640x480 display mode in 8bpp or 16bpp (needed by LEGO Island).
int GetDevice(int p_deviceNum, MxDriver *&p_driver, Direct3DDeviceInfo *&p_device)
[AI] Outputs pointers to the MxDriver and Direct3DDeviceInfo for the given device index.
static int SupportsMMX()
[AI] Checks if the CPU supports MMX instructions.
unsigned char FUN_1009d3d0(Direct3DDeviceInfo &p_device)
[AI] Checks if a device supports required rendering features (Z-buffer, perspective,...
int FUN_1009d0d0()
[AI] Finds and returns the preferred device index that supports required features.
int ParseDeviceName(const char *p_deviceId)
[AI] Parses a device string identifier and locates the matching device entry.
int FormatDeviceName(char *p_buffer, const MxDriver *p_ddInfo, const Direct3DDeviceInfo *p_d3dInfo) const
[AI] Formats and serializes a device identification string for a given driver/device.
int ProcessDeviceBytes(int p_deviceNum, GUID &p_guid)
[AI] Returns the index of the device matching the given GUID and driver number.
int FUN_1009d210()
[AI] Prunes the enumeration to only include devices/drivers that support the required display mode an...
int BETA_1011cc65(int p_idx, char *p_buffer)
[AI] Formats device identification string for the device at a specific global index (Beta10-specific)...
unsigned char IsInitialized() const
[AI] Checks if the enumeration has already been performed.
list< MxDriver > m_list
[AI] List of all discovered DirectDraw drivers and their device/mode info.
[AI] Set wrapper utilizing a custom allocator and comparator.
#define D3DPTEXTURECAPS_PERSPECTIVE
#define stack
[AI] Macro alias for Stack<C>, replacing std::stack.
#define set
[AI] Macro alias for Set<K, Pr>, replacing std::set<K>.
[AI] Encapsulates Direct3D device enumeration information and capability structures.
D3DDEVICEDESC m_HWDesc
[AI] Hardware Direct3D device capability description.
LPGUID m_guid
[AI] GUID uniquely identifying this 3D device. [AI]
[AI] Utility structure for GUID comparison.
[AI] Holds data about a DirectDraw driver including devices and supported display modes.
list< MxDisplayMode > m_displayModes
[AI] List of all display modes reported by the driver.
list< Direct3DDeviceInfo > m_devices
[AI] List of all Direct3D devices provided by this driver.
DWORD dwDeviceZBufferBitDepth
D3DCOLORMODEL dcmColorModel