Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS

Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
This commit is contained in:
Cyd
2026-06-24 21:28:16 -05:00
commit 2b8ca921cb
66341 changed files with 7923174 additions and 0 deletions
@@ -0,0 +1,36 @@
//===========================================================================//
// File: DLLPlatform.cpp //
// Project: GameOS //
// Contents: Setup GameOS for running DLL's //
//---------------------------------------------------------------------------//
// Date Who Modification //
// 02/15/99 AG Created //
//===========================================================================//
#include "DLLPlatform.hpp"
void InitGameOS( HINSTANCE hInstance, HWND hWnd, char* CommandLine )
{
Platform=Platform_DLL;
RunFromOtherApp( hInstance, hWnd, CommandLine );
}
//
// Memory management API's only occur in DLLPlatform project.
//
void* __cdecl operator new (size_t size, HGOSHEAP )
{
return malloc( size );
}
void* __cdecl operator new (size_t size)
{
// 0xffffffff specifies use of the heap set by CurrentHeapLevel
return malloc( size );
}
void __cdecl operator delete ( void* ptr )
{
free(ptr);
}
@@ -0,0 +1,159 @@
# Microsoft Developer Studio Project File - Name="DLLPlatform" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=DLLPlatform - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "DLLPlatform.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "DLLPlatform.mak" CFG="DLLPlatform - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "DLLPlatform - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "DLLPlatform - Win32 Profile" (based on "Win32 (x86) Static Library")
!MESSAGE "DLLPlatform - Win32 Armor" (based on "Win32 (x86) Static Library")
!MESSAGE "DLLPlatform - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""$/GameLeapCode/CoreTech/Libraries/DLLPlatform", OOAAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "DLLPlatform - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../../../rel.bin"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G6 /Gz /Zp4 /MD /W4 /GR /Zi /Ox /Ot /Oa /Og /Oi /Gy /I "..\..\Libraries" /I "..\..\..\CoreTech\Libraries" /D "NDEBUG" /D "_WINDOWS" /D "WIN32" /D "NOMINMAX" /Fd"Release/DLLPlatform" /Zl /FD /GF /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "DLLPlatform - Win32 Profile"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Profile"
# PROP BASE Intermediate_Dir "Profile"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../../../pro.bin"
# PROP Intermediate_Dir "Profile"
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G6 /Gz /Zp4 /MD /W4 /GR /Zi /Ox /Ot /Oa /Og /Oi /Gy /I "..\..\Libraries" /I "..\..\..\CoreTech\Libraries" /D "NDEBUG" /D "LAB_ONLY" /D "_WINDOWS" /D "WIN32" /D "NOMINMAX" /Fd"Profile/DLLPlatform" /Zl /FD /GF /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "DLLPlatform - Win32 Armor"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Armor"
# PROP BASE Intermediate_Dir "Armor"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../../../arm.bin"
# PROP Intermediate_Dir "Armor"
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G6 /Gz /Zp4 /MD /W4 /GR /Zi /Ox /Ot /Oa /Og /Oi /Gy /I "..\..\Libraries" /I "..\..\..\CoreTech\Libraries" /D "NDEBUG" /D "LAB_ONLY" /D "_WINDOWS" /D "WIN32" /D "NOMINMAX" /D "_ARMOR" /Fd"Armor/DLLPlatform" /Zl /FD /GF /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "DLLPlatform - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../../../dbg.bin"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G6 /Gz /Zp4 /MDd /W4 /GR /Zi /Od /I "..\..\Libraries" /I "..\..\..\CoreTech\Libraries" /D "LAB_ONLY" /D "NOMINMAX" /D "_ARMOR" /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /Fd"Debug/DLLPlatform" /Zl /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "DLLPlatform - Win32 Release"
# Name "DLLPlatform - Win32 Profile"
# Name "DLLPlatform - Win32 Armor"
# Name "DLLPlatform - Win32 Debug"
# Begin Source File
SOURCE=.\DLLPlatform.cpp
!IF "$(CFG)" == "DLLPlatform - Win32 Release"
!ELSEIF "$(CFG)" == "DLLPlatform - Win32 Profile"
!ELSEIF "$(CFG)" == "DLLPlatform - Win32 Armor"
!ELSEIF "$(CFG)" == "DLLPlatform - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\DLLPlatform.hpp
# End Source File
# End Target
# End Project
@@ -0,0 +1,22 @@
//===========================================================================//
// File: DLLPlatform.hpp //
// Project: GameOS //
// Contents: Setup GameOS for running DLL's //
//---------------------------------------------------------------------------//
// Date Who Modification //
// 02/15/99 AG Created //
//===========================================================================//
#define WIN32_EXTRA_LEAN // Reduce windows header size
#define VC_EXTRALEAN // Reduce windows header size
#include <windows.h>
#include <GameOS\Platform.hpp>
#include <GameOS\GameOS.hpp>
long _stdcall ProcessException( EXCEPTION_POINTERS* ep );
void _stdcall InitExceptionHandler( char* CommandLine );
void _stdcall InitGameOS( HINSTANCE hInstance, HWND hWindow, char* CommandLine );
LRESULT CALLBACK GameOSWinProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
DWORD _stdcall RunGameOSLogic();
void _stdcall ExitGameOS();
@@ -0,0 +1,65 @@
//-----------------------------------------------------------------------------
// ZoneAsync.h
//
// Copyright (c) Microsoft Corp. 1999-2000. All rights reserved.
//
// Content: Interface for Managing Asynchronous objects.
//
//-----------------------------------------------------------------------------
#pragma once
#include "ZoneTechErr.h"
interface __declspec(
uuid( "9DAF85BB-851D-42df-A236-B5EE965582DD" ) ) IZoneAsync;
#define IID_IZoneAsync __uuidof( IZoneAsync )
interface IZoneAsync: public IUnknown
{
enum CAPS {
CAPS_SINGLE_USE =0x1,
CAPS_SUPPORTS_PAUSE =0x2,
CAPS_CONTINUOUS =0x4
};
enum STATUS {
// These status are the "not running" states.
//
STATUS_CREATED=0x100, // Object is blank.
STATUS_INITIALIZED, // Object is ready to Start()
STATUS_FAILED,
STATUS_COMPLETED,
STATUS_CANCELLED,
// Transition States.
STATUS_STARTING=0x200,
STATUS_STOPPING,
// Operating States.
STATUS_RUNNING=0x400,
STATUS_PAUSED,
};
virtual HRESULT STDMETHODCALLTYPE Start( IN HANDLE hEvent ) = 0;
virtual HRESULT STDMETHODCALLTYPE Stop () = 0;
virtual HRESULT STDMETHODCALLTYPE Pause () = 0;
virtual HRESULT STDMETHODCALLTYPE Continue () = 0;
virtual HRESULT STDMETHODCALLTYPE GetCaps ( OUT DWORD *pdwCaps ) = 0;
virtual HRESULT STDMETHODCALLTYPE GetStatus ( OUT STATUS* pStatus ) = 0;
virtual HRESULT STDMETHODCALLTYPE GetLastError () = 0;
};
#define IS_NOT_RUNNING(state) (state&0x100)
#define IS_TRANSITION(state) (state&0x200)
#define IS_OPERATING(state) (state&0x400)
@@ -0,0 +1,361 @@
//-----------------------------------------------------------------------------
// ZoneMatch.h
//
// Copyright (c) Microsoft Corp. 1999-2000. All rights reserved.
//
// Content: Interface for the Zone's game server directory
//
//-----------------------------------------------------------------------------
#pragma once
#include "ZoneTechErr.h"
/////////////////////////////////////////////////////////////////////////////
// ZoneMatch Browser API.
/////////////////////////////////////////////////////////////////////////////
//
// notes:
//
// All character strings used throughout the API are zero-terminated
// String lengths up to 127 bytes are supported ( 128 including zero-terminator )
//
// All enumeration callbacks continue the enumeration if TRUE is returned.
//
//
// All port numbers are in host byte order.
//
class __declspec(
uuid( "9BE1D721-77ED-11d3-A3CF-00C04F5F1241" ) ) CZoneMatchBrowser;
class __declspec(
uuid( "42BA50DA-3424-11d3-BA6C-00C04F8EF92F" ) ) CZoneMatchApplication;
interface __declspec(
uuid( "9BE1D722-77ED-11d3-A3CF-00C04F5F1241" ) ) IZoneMatchBrowser;
interface __declspec(
uuid( "9BE1D723-77ED-11d3-A3CF-00C04F5F1241" ) ) IZoneMatchTable;
interface __declspec(
uuid( "D809231D-5D93-4299-9D7F-C2F871BDADA3" ) ) IZoneMatchTableView;
interface __declspec(
uuid( "9BE1D725-77ED-11d3-A3CF-00C04F5F1241" ) ) IZoneRowManager;
interface __declspec(
uuid( "42BA50DB-3424-11d3-BA6C-00C04F8EF92F" ) ) IZoneMatchApplication;
interface __declspec(
uuid( "42BA50DC-3424-11d3-BA6C-00C04F8EF92F" ) ) IZoneMatchRegistration;
//
// Also allow the old name style.
//
#define CLSID_ZoneMatchBrowser __uuidof( CZoneMatchBrowser )
#define CLSID_ZoneMatchApplication __uuidof( CZoneMatchApplication )
#define IID_IZoneMatchBrowser __uuidof( IZoneMatchBrowser )
#define IID_IZoneMatchTable __uuidof( IZoneMatchTable )
#define IID_IZoneMatchTableView __uuidof( IZoneMatchTableView )
#define IID_IZoneRowManager __uuidof( IZoneRowManager )
#define IID_IZoneMatchApplication __uuidof( IZoneMatchApplication )
#define IID_IZoneMatchRegistration __uuidof( IZoneMatchRegistration )
#define MAX_ROWFILTER_LENGTH 4096
typedef class tagZoneMatchRow
{
private:
// Use IZoneRowManager ONLY, to make rows!
//
tagZoneMatchRow();
tagZoneMatchRow( const tagZoneMatchRow & );
public:
inline DWORD Count() const
{ return cStrings; };
inline LPCSTR Strings( DWORD i ) const
{ return apszStrings[i]; };
private:
DWORD cStrings;
LPCSTR apszStrings[1];
} const *LPZONEMATCHROW;
//
// This interface is used to create, dup and Free ZONEMASTERROWS.
// It is found with IZoneMatchTable and IZoneMatchTableView.
//
interface IZoneRowManager : public IUnknown
{
virtual HRESULT STDMETHODCALLTYPE AllocateRow(
IN DWORD cValues,
IN LPCSTR const * apszValues,
OUT LPZONEMATCHROW* ppRow ) = 0;
virtual HRESULT STDMETHODCALLTYPE FreeRow(
IN LPZONEMATCHROW pRow ) = 0;
virtual HRESULT STDMETHODCALLTYPE DupRow(
IN LPZONEMATCHROW pRow,
OUT LPZONEMATCHROW* ppRow ) = 0;
};
//
// This interface is used with IZoneAsync
//
interface IZoneMatchBrowser : public IUnknown
{
typedef void ( WINAPI FN_ZM_REFRESH ) (
IN PVOID pReserved,
IN PVOID pContext );
typedef FN_ZM_REFRESH *LPFN_ZM_REFRESH;
virtual HRESULT STDMETHODCALLTYPE InitZMBrowser (
IN LPCSTR pszMaster,
IN unsigned short wPort,
IN const GUID& guidApplication,
IN LPFN_ZM_REFRESH pfnRefresh,
IN PVOID pRefreshContext ) = 0;
enum TABLE {
TABLE_NONE,
TABLE_SERVER,
TABLE_PLAYER
};
virtual HRESULT STDMETHODCALLTYPE CreateTable(
IN LPUNKNOWN pUnkOuter,
IN REFIID riid,
IN TABLE table,
OUT LPVOID* ppTableInf) = 0;
virtual HRESULT STDMETHODCALLTYPE Refresh( ) = 0;
};
interface IZoneMatchTable : public IUnknown
{
virtual HRESULT STDMETHODCALLTYPE GetAllHeaders(
OUT LPZONEMATCHROW* ppRow ) = 0;
virtual HRESULT STDMETHODCALLTYPE CreateView(
IN LPUNKNOWN pUnkOuter,
IN REFIID riid,
IN LPZONEMATCHROW pColumnFilter,
IN LPCSTR pszRowFilter,
IN LPCSTR pszSortAttribute,
IN BOOL bSortAscending,
OUT PVOID* pView ) = 0;
};
interface IZoneMatchTableView : public IUnknown
{
enum UPDATE_STATUS { ROW_UPDATE, ROW_DELETED,
ROW_STALE, ROW_END };
typedef void (WINAPI FN_ZMTABLE_DATA) (
IN DWORD iRowID,
IN UPDATE_STATUS status,
IN LPZONEMATCHROW pRow,
IN PVOID pContext );
typedef FN_ZMTABLE_DATA *LPFN_ZMTABLE_DATA;
virtual HRESULT STDMETHODCALLTYPE SetUpdateCursorRange(
IN DWORD dwStartingIndex,
IN DWORD dwUpdateRange )=0;
virtual HRESULT STDMETHODCALLTYPE StartData(
IN BOOL bUpdate,
IN LPFN_ZMTABLE_DATA pfnData,
IN PVOID pContext )=0;
virtual HRESULT STDMETHODCALLTYPE CloseData()=0;
virtual HRESULT STDMETHODCALLTYPE GetViewSize(
OUT PDWORD pdwSize )=0;
};
/////////////////////////////////////////////////////////////////////////////
// ZoneMatch Registration API.
/////////////////////////////////////////////////////////////////////////////
// Port on the Master Server in the data center.
// Game Servers connect here to register.
// Game Clients connect here to browse.
//
#define MASTER_SERVER_NAME "match.zone.com"
#define MASTER_SERVER_PORT 28805
// Port on the Game Server Application that the Query Server
// connects to and pings for registration data.
//
#define APP_QUERY_PORT 27999
//
// notes:
//
// All character strings used throughout the API are zero-terminated
// String lengths up to 127 bytes are supported ( 128 including zero-terminator )
//
// All enumeration callbacks continue the enumeration if TRUE is returned.
//
//
// All port numbers are in host byte order
//
interface IZoneMatchApplication : public IUnknown
{
typedef BOOL ( WINAPI *LPFN_ZM_ENUM_IPADDRS )(
IN LPCSTR pszIpAddr,
IN LPVOID pContext );
virtual HRESULT STDMETHODCALLTYPE EnumApplicationAddrs(
IN LPFN_ZM_ENUM_IPADDRS,
IN LPVOID pContext ) = 0;
struct APPDESCRIPTION {
GUID guidApplication;
LPCSTR pszProductName;
LPCSTR pszModName;
LPCSTR pszVersion;
GUID guidInstanceID;
unsigned short wAppServerPort;
LPCSTR pszServerName;
DWORD dwMaxPlayers;
BOOL bPasswordProtected;
};
typedef APPDESCRIPTION const* LPCAPPDESCRIPTION;
virtual HRESULT STDMETHODCALLTYPE InitApplication(
IN LPCAPPDESCRIPTION pAppDesc,
IN LPCSTR pszAppQueryAddr, // Defaults if == NULL
IN unsigned short wAppQueryPort // Defaults if = 0
) = 0;
virtual HRESULT STDMETHODCALLTYPE Close() = 0;
enum QUERY_LEVEL {
QL_NONE = 0,
QL_PING = 10,
QL_REGISTRATION = 20,
QL_GAME_VALUES = 30,
QL_PLAYERS = 40,
QL_PLAYER_VALUES = 50,
QL_ALL = 100
};
virtual HRESULT STDMETHODCALLTYPE SetQueryLevel(
IN QUERY_LEVEL QueryLevel ) = 0;
virtual HRESULT STDMETHODCALLTYPE GetQueryLevel(
OUT QUERY_LEVEL* pQueryLevel ) = 0;
virtual HRESULT STDMETHODCALLTYPE SetMatchEncryptionKey(
IN LPBYTE pBuf,
IN DWORD cbBuf ) = 0;
virtual HRESULT STDMETHODCALLTYPE SetGameEncryptionKey(
IN LPBYTE pBuf,
IN DWORD cbBuf ) = 0;
virtual HRESULT STDMETHODCALLTYPE CreateRegistration(
IN IUnknown* pUnkOuter,
IN REFIID riid,
OUT void** ppInf ) = 0;
// Managing Players.
virtual HRESULT STDMETHODCALLTYPE AddPlayer(
IN DWORD dwItemID,
IN LPCSTR pszPlayerName ) = 0;
virtual HRESULT STDMETHODCALLTYPE GetPlayer(
IN DWORD dwItemID,
OUT LPSTR pszPlayerName,
IN DWORD cbPlayerName ) = 0;
virtual HRESULT STDMETHODCALLTYPE DeletePlayer(
IN DWORD dwItemID ) = 0;
virtual HRESULT STDMETHODCALLTYPE GetNumPlayers(
OUT DWORD* pdwNumPlayers ) = 0;
typedef BOOL ( WINAPI *LPFN_ENUM_PLAYERS )(
IN DWORD dwItemID,
IN LPCSTR pszPlayerName,
IN LPVOID pContext );
virtual HRESULT STDMETHODCALLTYPE EnumPlayers(
IN LPFN_ENUM_PLAYERS pfn,
IN LPVOID pContext ) = 0;
// Managing Values on Servers and Players
virtual HRESULT STDMETHODCALLTYPE SetItemValue(
IN DWORD dw,
IN LPCSTR pszKey,
IN LPCSTR pszValue ) = 0;
virtual HRESULT STDMETHODCALLTYPE GetItemValue(
IN DWORD dw,
IN LPCSTR pszKey,
OUT LPSTR pszValue,
IN DWORD cbValue ) = 0;
virtual HRESULT STDMETHODCALLTYPE DeleteItemValue(
IN DWORD dw,
IN LPCSTR pszKey ) = 0;
virtual HRESULT STDMETHODCALLTYPE GetNumItemValues(
IN DWORD dwItemID,
OUT DWORD* pdwNumValues ) = 0;
typedef BOOL ( WINAPI *LPFN_ENUM_ITEM_VALUES )(
IN DWORD dwItemID,
IN LPCSTR pszKey,
IN LPCSTR pszValue,
IN LPVOID pContext );
virtual HRESULT STDMETHODCALLTYPE EnumItemValues(
IN DWORD dwItemID,
IN LPFN_ENUM_ITEM_VALUES pfn,
IN LPVOID pContext ) = 0;
};
#define SERVER_ITEM_ID 0
#define ILLEGAL_ITEM_ID 0xFFFFFFFF
#ifndef _TIME_T_DEFINED
typedef long time_t;
#define _TIME_T_DEFINED
#endif
//
// This interface is used with IZoneAsync.
//
interface IZoneMatchRegistration : public IUnknown
{
virtual HRESULT STDMETHODCALLTYPE InitRegistration(
IN LPCSTR pszMasterAddr, // Defaults if == NULL
IN unsigned short wMasterPort // defaults if == 0
) = 0;
virtual HRESULT STDMETHODCALLTYPE GetRegistration(
OUT LPSTR pszQueryAddr,
IN DWORD cbQueryAddr,
OUT unsigned short* pQueryPort,
OUT time_t* pConnectTime ) = 0;
};
@@ -0,0 +1,506 @@
/*++
Copyright (c) 1999 Microsoft Corporation
Module Name:
GunErr.h
Abstract:
Definitions for ZoneTech error messages.
Author:
Revision History:
Notes:
This file is generated by the MC tool from the ZoneTecherr.mc file.
--*/
#ifndef _ZONETECHRR_H_
#define _ZONETECHERR_H_
#define STATUS_SEVERITY(hr) (((hr) >> 30) & 0x3)
// Customer Bit is set by the message compiler command line arguments
/////////////////////////////////////////////////////////////////////////
//
// ZoneTech General Error Codes
//
/////////////////////////////////////////////////////////////////////////
//
// Values are 32 bit values layed out as follows:
//
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
// +---+-+-+-----------------------+-------------------------------+
// |Sev|C|R| Facility | Code |
// +---+-+-+-----------------------+-------------------------------+
//
// where
//
// Sev - is the severity code
//
// 00 - Success
// 01 - Informational
// 10 - Warning
// 11 - Error
//
// C - is the Customer code flag
//
// R - is a reserved bit
//
// Facility - is the facility code
//
// Code - is the facility's status code
//
//
// Define the facility codes
//
#define FACILITY_ZONETECH 0x112
#define FACILITY_ZNULL 0x0
//
// Define the severity codes
//
#define STATUS_SEVERITY_WARNING 0x2
#define STATUS_SEVERITY_SUCCESS 0x0
#define STATUS_SEVERITY_INFORMATIONAL 0x1
#define STATUS_SEVERITY_ERROR 0x3
//
// MessageId: ZT_E_VERSION_NOT_AVAIL
//
// MessageText:
//
// The requested component version in not available.
//
#define ZT_E_VERSION_NOT_AVAIL 0xC1120001L
//
// MessageId: ZT_E_BUFFER_TOO_SMALL
//
// MessageText:
//
// The provided buffer is too small to complete the operation.
//
#define ZT_E_BUFFER_TOO_SMALL 0xC1120002L
//
// MessageId: ZT_E_INTERNAL
//
// MessageText:
//
// An internal error occurred.
//
#define ZT_E_INTERNAL 0xC1120003L
//
// MessageId: ZT_E_INVALID_STATUS
//
// MessageText:
//
// The ZoneTech object status is not in an expected state.
//
#define ZT_E_INVALID_STATUS 0xC1120004L
//
// MessageId: ZT_E_STR_TOO_LONG
//
// MessageText:
//
// The string exceeds the maximum supported string length for this operation.
//
#define ZT_E_STR_TOO_LONG 0xC1120005L
//
// MessageId: ZT_E_PENDING
//
// MessageText:
//
// The operation is pending.
//
#define ZT_E_PENDING 0xC1120006L
//
// MessageId: ZT_E_ATTR_NOT_FOUND
//
// MessageText:
//
// The Attribute was not found.
//
#define ZT_E_ATTR_NOT_FOUND 0xC1120007L
//
// MessageId: ZT_E_NOT_INITED
//
// MessageText:
//
// The Init method for this object must be called before this operation.
//
#define ZT_E_NOT_INITED 0xC1120008L
//
// MessageId: ZT_E_ALREADY_INITED
//
// MessageText:
//
// The Init method cannot be called more than once on this object.
//
#define ZT_E_ALREADY_INITED 0xC1120009L
//
// MessageId: ZT_E_WRONG_THREAD
//
// MessageText:
//
// Call to object was made on the wrong thread.
//
#define ZT_E_WRONG_THREAD 0xC112000AL
//
// MessageId: ZONE_E_ASSERT
//
// MessageText:
//
// %1
//
#define ZONE_E_ASSERT 0xC112000BL
/////////////////////////////////////////////////////////////////////////
//
// ZoneTech Network Error Codes
//
/////////////////////////////////////////////////////////////////////////
//
// MessageId: ZT_E_CANNOT_INIT_WINSOCK
//
// MessageText:
//
// Failed to initialize the Windows Sockets library.
//
#define ZT_E_CANNOT_INIT_WINSOCK 0xC11203E8L
//
// MessageId: ZT_E_FAILED_TO_CONNECT
//
// MessageText:
//
// Failed to connect to the specified server.
//
#define ZT_E_FAILED_TO_CONNECT 0xC11203E9L
//
// MessageId: ZT_E_CONNECTION_CLOSED
//
// MessageText:
//
// The connection to the server was unexpectedly closed.
//
#define ZT_E_CONNECTION_CLOSED 0xC11203EAL
//
// MessageId: ZT_E_SEND_FAILED
//
// MessageText:
//
// Failed to send data to the connected server.
//
#define ZT_E_SEND_FAILED 0xC11203EBL
//
// MessageId: ZT_E_NO_ADAPTER
//
// MessageText:
//
// Failed to query information about the TCP/IP adapter.
//
#define ZT_E_NO_ADAPTER 0xC11203ECL
//
// MessageId: ZT_E_NOT_CONNECTED
//
// MessageText:
//
// The connection is not established.
//
#define ZT_E_NOT_CONNECTED 0xC11203EDL
//
// MessageId: ZT_E_WINSOCK_ERROR
//
// MessageText:
//
// A unexpected winsock error occurred. Use WSAGetLastError to retreive the specific error code.
//
#define ZT_E_WINSOCK_ERROR 0xC11203EEL
//
// MessageId: ZT_E_RECEIVE_FAILED
//
// MessageText:
//
// Failed to receive data from the connected server.
//
#define ZT_E_RECEIVE_FAILED 0xC11203EFL
//
// MessageId: ZT_E_WAITMAX_EXCEEDED
//
// MessageText:
//
// The Maximum number of pending operations has been exceeded.
//
#define ZT_E_WAITMAX_EXCEEDED 0xC11203F0L
/////////////////////////////////////////////////////////////////////////
//
// ZoneTech Authentication Error Codes
//
/////////////////////////////////////////////////////////////////////////
//
// MessageId: ZT_E_AUTH_INVALID_STATUS
//
// MessageText:
//
// The ZoneAuth Session status is not in an expected state.
//
#define ZT_E_AUTH_INVALID_STATUS 0xC11207D0L
//
// MessageId: ZT_E_AUTH_PENDING
//
// MessageText:
//
// The ZoneAuth Session has not yet completed authentication.
//
#define ZT_E_AUTH_PENDING 0xC11207D1L
//
// MessageId: ZT_E_AUTH_TIMEOUT
//
// MessageText:
//
// The ZoneAuth Session was failed because the connection was timed out by the client.
//
#define ZT_E_AUTH_TIMEOUT 0xC11207D2L
//
// MessageId: ZT_E_AUTH_INVALID_PACKET
//
// MessageText:
//
// The ZoneAuth Session received an invalid packet from the server.
//
#define ZT_E_AUTH_INVALID_PACKET 0xC11207D3L
//
// MessageId: ZT_E_AUTH_USER_CANCEL
//
// MessageText:
//
// The ZoneAuth Session was cancelled by the user.
//
#define ZT_E_AUTH_USER_CANCEL 0xC11207D4L
//
// MessageId: ZT_E_AUTH_DENIED
//
// MessageText:
//
// The ZoneAuth Session's credentials failed authentication.
//
#define ZT_E_AUTH_DENIED 0xC11207D5L
//
// MessageId: ZT_E_AUTH_INVALID_TICKET
//
// MessageText:
//
// The ZoneAuth Ticket provided was invalid.
//
#define ZT_E_AUTH_INVALID_TICKET 0xC11207D6L
//
// MessageId: ZT_E_AUTH_NO_CACHE
//
// MessageText:
//
// There are no cache credentials to provide re-authentication against.
//
#define ZT_E_AUTH_NO_CACHE 0xC11207D7L
//
// MessageId: ZT_E_AUTH_NO_LOGIN_INFO
//
// MessageText:
//
// There is not previously stored login information.
//
#define ZT_E_AUTH_NO_LOGIN_INFO 0xC11207D8L
/////////////////////////////////////////////////////////////////////////
//
// ZoneTech Match Error Codes
//
/////////////////////////////////////////////////////////////////////////
//
// MessageId: ZT_E_MATCH_NO_KEY
//
// MessageText:
//
// The specified key does not exist.
//
#define ZT_E_MATCH_NO_KEY 0xC11207D9L
//
// MessageId: ZT_E_MATCH_NO_PLAYER
//
// MessageText:
//
// The specified player ID does not exist.
//
#define ZT_E_MATCH_NO_PLAYER 0xC11207DAL
//
// MessageId: ZT_E_MATCH_PLAYER_EXISTS
//
// MessageText:
//
// The specified player ID already exists.
//
#define ZT_E_MATCH_PLAYER_EXISTS 0xC11207DBL
//
// MessageId: ZT_E_MATCH_RONLY_ATTR
//
// MessageText:
//
// Cannot assign to a read only attribute.
//
#define ZT_E_MATCH_RONLY_ATTR 0xC11207DCL
//
// MessageId: ZT_E_PROTOCOL_ERROR
//
// MessageText:
//
// An error in the ZoneTech network protocol was encountered.
//
#define ZT_E_PROTOCOL_ERROR 0xC11207DDL
//
// MessageId: ZT_E_BAD_PROTOCOL_VER
//
// MessageText:
//
// Incompatible Protocol version mismatch.
//
#define ZT_E_BAD_PROTOCOL_VER 0xC11207DEL
//
// MessageId: ZT_E_NO_QUERYSERVER
//
// MessageText:
//
// The ZoneMatch Server for the specified Game GUID is not found.
//
#define ZT_E_NO_QUERYSERVER 0xC11207DFL
//
// MessageId: ZT_E_ALREADY_RUNNING
//
// MessageText:
//
// Object is already running.
//
#define ZT_E_ALREADY_RUNNING 0xC11207E0L
//
// MessageId: ZT_E_CLOSED
//
// MessageText:
//
// Object is closed.
//
#define ZT_E_CLOSED 0xC11207E1L
//
// MessageId: ZT_E_INVALID_COLUMN
//
// MessageText:
//
// Supplied column does not exist.
//
#define ZT_E_INVALID_COLUMN 0xC11207E2L
//
// MessageId: ZT_E_DISCONNECTED
//
// MessageText:
//
// Client is disconnected from the server.
//
#define ZT_E_DISCONNECTED 0xC11207E3L
//
// MessageId: ZT_E_NOT_READY
//
// MessageText:
//
// The Object is not ready to perform the request operation at this time.
//
#define ZT_E_NOT_READY 0xC11207E4L
/////////////////////////////////////////////////////////////////////////
//
// ZoneTech XML Parsing Error Codes
//
/////////////////////////////////////////////////////////////////////////
//
// MessageId: ZT_E_XML_SYNTAX_ERROR
//
// MessageText:
//
// An XML syntax error has be encountered.
//
#define ZT_E_XML_SYNTAX_ERROR 0xC11207E5L
//
// MessageId: ZT_E_TOO_MANY_ATTRIBUTES
//
// MessageText:
//
// An XML tag has too many attribute fields.
//
#define ZT_E_TOO_MANY_ATTRIBUTES 0xC11207E6L
//
// MessageId: ZT_E_MISMATCHED_XML_TAGS
//
// MessageText:
//
// The XML Start and End Tags do Not Match.
//
#define ZT_E_MISMATCHED_XML_TAGS 0xC11207E7L
#endif // _ZONETECHERR_H_
@@ -0,0 +1,87 @@
#include "pch.hpp"
//===========================================================================//
// File: 3D T&L.cpp //
// Project: GameOS //
// Contents: Functions for hardware transform and lighting //
//---------------------------------------------------------------------------//
// Date Who Modification //
// 12/27/99 AG Created //
// //
//---------------------------------------------------------------------------//
// Copyright (C) 1999 Microsoft Corp. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#include "3DRasterizer.hpp"
#include "DXRasterizer.hpp"
#include "DirectX.hpp"
#include "Debugger.hpp"
//
//
//
void __stdcall gos_SetTransform( gosTRANSFORMTYPE TransformType, gosMATRIX* MatrixData )
{
gosASSERT( InsideBeginScene);
gosASSERT( TransformType>=MATRIX_WORLD && TransformType<=MATRIX_WORLD1 );
SafeFPU();
wSetTransform( d3dDevice7, (D3DTRANSFORMSTATETYPE)TransformType, (LPD3DMATRIX)MatrixData );
GameOSFPU();
}
//
//
//
void __stdcall gos_MultiplyTransform( gosTRANSFORMTYPE TransformType, gosMATRIX* MatrixData )
{
gosASSERT( InsideBeginScene);
gosASSERT( TransformType>=MATRIX_WORLD && TransformType<=MATRIX_WORLD1 );
SafeFPU();
wMultiplyTransform( d3dDevice7, (D3DTRANSFORMSTATETYPE)TransformType, (LPD3DMATRIX)MatrixData );
GameOSFPU();
}
//
//
//
void __stdcall gos_SetLight( DWORD LightNumber, gosLIGHT* LightData )
{
gosASSERT( InsideBeginScene);
gosASSERT( sizeof(D3DLIGHT7)==sizeof(gosLIGHT) );
SafeFPU();
wSetLight( d3dDevice7, LightNumber, (LPD3DLIGHT7)LightData );
GameOSFPU();
}
//
//
//
void __stdcall gos_LightEnable( DWORD LightNumber, bool Enable )
{
gosASSERT( InsideBeginScene);
SafeFPU();
wLightEnable( d3dDevice7, LightNumber, Enable );
GameOSFPU();
}
//
//
//
void __stdcall gos_SetMaterial( gosMATERIAL* MaterialData )
{
gosASSERT( InsideBeginScene);
gosASSERT( sizeof(D3DMATERIAL7)==sizeof(gosMATERIAL) );
SafeFPU();
wSetMaterial( d3dDevice7, (LPD3DMATERIAL7)MaterialData );
GameOSFPU();
}
@@ -0,0 +1,484 @@
#include "pch.hpp"
//===========================================================================//
// File: 3DPrimitives.cpp //
// Project: GameOS //
// Contents: Functions that draw 3D primitives //
//---------------------------------------------------------------------------//
// Date Who Modification //
// 27/11/98 AG Created //
// //
//---------------------------------------------------------------------------//
// Copyright (C) 1999 Microsoft Corp. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#include "3DRasterizer.hpp"
#include "DXRasterizer.hpp"
#include "DirectX.hpp"
#include "Debugger.hpp"
DWORD FanCalls;
DWORD StripCalls;
float FanLength;
float StripLength;
//
// Application visible function
//
// Draws points - must have already called gos_SetupViewport
// Note wireframe does not effect points
//
void __stdcall gos_DrawPoints( gos_VERTEX* Vertices, int NumVertices )
{
LOG_BLOCK("Gos3D::DrawPoints");
gosASSERT( !RenderDevice && InsideBeginScene && Vertices && NumVertices );
if( DirtyStates )
FlushRenderStates();
#ifdef _ARMOR
CheckVertices( Vertices, NumVertices, 1 );
#endif
#ifdef LAB_ONLY
if( gDisableLinesPoints && !InDebugger )
return;
PrimitivesRendered+=NumVertices;
PointsRendered+=NumVertices;
if( ZoomMode )
{
for( int t0=0; t0<NumVertices; t0++ )
{
gos_VERTEX nv1=Vertices[t0];
nv1.x-=(DBMouseX-nv1.x)*ZoomMode;
nv1.y-=(DBMouseY-nv1.y)*ZoomMode;
wDrawPrimitive( d3dDevice7, D3DPT_POINTLIST, D3DFVF_TLVERTEX, &nv1, 1, 0 );
}
return;
}
#endif
SafeFPU(); // Make sure exceptions cannot be generated
wDrawPrimitive( d3dDevice7, D3DPT_POINTLIST, D3DFVF_TLVERTEX, Vertices, NumVertices, 0 );
GameOSFPU(); // Restore current GameOS FPU control word setup
}
//
// Application visible function
//
// Draws lines - must have already called gos_SetupViewport
// Note wireframe does not effect lines
//
void __stdcall gos_DrawLines( gos_VERTEX* Vertices, int NumVertices )
{
LOG_BLOCK("Gos3D::DrawLines");
gosASSERT( !RenderDevice && InsideBeginScene && Vertices && NumVertices && (NumVertices&1)==0 );
if( DirtyStates )
FlushRenderStates();
#ifdef _ARMOR
CheckVertices( Vertices, NumVertices, 1 );
#endif
#ifdef LAB_ONLY
if( gDisableLinesPoints && !InDebugger )
return;
PrimitivesRendered+=NumVertices>>1;
LinesRendered+=NumVertices>>1;
if( ZoomMode )
{
for( int t0=0; t0<NumVertices; t0+=2 )
{
gos_VERTEX nv[2];
nv[0]=Vertices[t0];
nv[1]=Vertices[t0+1];
nv[0].x-=(DBMouseX-nv[0].x)*ZoomMode;
nv[0].y-=(DBMouseY-nv[0].y)*ZoomMode;
nv[1].x-=(DBMouseX-nv[1].x)*ZoomMode;
nv[1].y-=(DBMouseY-nv[1].y)*ZoomMode;
wDrawPrimitive( d3dDevice7, D3DPT_LINELIST, D3DFVF_TLVERTEX, nv, 2, 0 );
}
return;
}
#endif
SafeFPU(); // Make sure exceptions cannot be generated
wDrawPrimitive( d3dDevice7, D3DPT_LINELIST, D3DFVF_TLVERTEX, Vertices, NumVertices, 0 );
GameOSFPU(); // Restore current GameOS FPU control word setup
}
//
// Application visible function
//
// Draws triangles - must have already called gos_SetupViewport
//
void __stdcall gos_DrawTriangles( gos_VERTEX* Vertices, int NumVertices )
{
LOG_BLOCK("Gos3D::DrawTriangles");
gosASSERT( InsideBeginScene && Vertices && NumVertices && (NumVertices%3)==0 );
if( RenderDevice )
{
LOG_BLOCK("Gos3D::DrawTriangles RenderDevice->DrawPrimitive");
RenderDevice->DrawPrimitive( D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, Vertices, NumVertices, 0 );
return;
}
if( DirtyStates )
FlushRenderStates();
#ifdef _ARMOR
CheckVertices( Vertices, NumVertices );
#endif
#ifdef LAB_ONLY
if( gDisablePrimitives && !InDebugger )
return;
PrimitivesRendered+=NumVertices/3;
TrianglesRendered+=NumVertices/3;
if( RenderMode )
{
for( int t0=0; t0<NumVertices; t0+=3 )
{
DebugTriangle( &Vertices[t0], &Vertices[t0+1], &Vertices[t0+2] );
}
return;
}
#endif
SafeFPU(); // Make sure exceptions cannot be generated
wDrawPrimitive( d3dDevice7, D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, Vertices, NumVertices, 0 );
GameOSFPU(); // Restore current GameOS FPU control word setup
}
//
// Array of indices for a single quad represented as a strip
//
WORD SingleQuadIndexArray[4] = { 1, 0, 2, 3 };
//
// Application visible function
//
// Draws quads - must have already called gos_SetupViewport
//
// 0 3
//
// 1 2
//
void __stdcall gos_DrawQuads( gos_VERTEX* Vertices, int NumVertices )
{
LOG_BLOCK("Gos3D::DrawQuads");
gosASSERT( !RenderDevice && InsideBeginScene && Vertices && NumVertices && (NumVertices&3)==0 );
gosASSERT( (NumVertices+(NumVertices>>1))<128*6 );
if( DirtyStates )
FlushRenderStates();
#ifdef _ARMOR
CheckVertices( Vertices, NumVertices );
#endif
#ifdef LAB_ONLY
if( gDisablePrimitives && !InDebugger )
return;
PrimitivesRendered+=NumVertices>>1;
QuadsRendered+=NumVertices>>2;
if( RenderMode )
{
for( int t0=0; t0<NumVertices; t0+=4 )
{
DebugTriangle( &Vertices[t0], &Vertices[t0+1], &Vertices[t0+2] );
DebugTriangle( &Vertices[t0], &Vertices[t0+2], &Vertices[t0+3] );
}
return;
}
#endif
SafeFPU(); // Make sure exceptions cannot be generated
if( NumVertices<128 )
{
wDrawIndexedPrimitive( d3dDevice7, D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, Vertices, NumVertices, QuadIndex, (NumVertices+(NumVertices>>1)), 0 );
}
else
{
do
{
if( NumVertices>=128 )
{
wDrawIndexedPrimitive( d3dDevice7, D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, Vertices, 128, QuadIndex, 192, 0 );
NumVertices-=128;
Vertices+=128;
}
else
{
wDrawIndexedPrimitive( d3dDevice7, D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, Vertices, NumVertices, QuadIndex, NumVertices+(NumVertices>>1), 0 );
NumVertices=0;
}
}
while( NumVertices );
}
GameOSFPU(); // Restore current GameOS FPU control word setup
}
//
// Application visible function
//
// Draws a strip - must have already called gos_SetupViewport
//
void __stdcall gos_DrawStrips( gos_VERTEX* Vertices, int NumVertices )
{
LOG_BLOCK("Gos3D::DrawStrips");
gosASSERT( !RenderDevice && InsideBeginScene && Vertices && NumVertices>=3 );
if( DirtyStates )
FlushRenderStates();
#ifdef _ARMOR
CheckVertices( Vertices, NumVertices );
#endif
#ifdef LAB_ONLY
if( gDisablePrimitives && !InDebugger )
return;
PrimitivesRendered+=NumVertices-2;
StripLength+=NumVertices-2;
StripCalls++;
if( RenderMode )
{
for( int t0=0; t0<NumVertices-2; t0++ )
{
DebugTriangle( &Vertices[t0], &Vertices[t0+1], &Vertices[t0+2] );
}
return;
}
#endif
SafeFPU(); // Make sure exceptions cannot be generated
wDrawPrimitive( d3dDevice7, D3DPT_TRIANGLESTRIP, D3DFVF_TLVERTEX, Vertices, NumVertices, 0 );
GameOSFPU(); // Restore current GameOS FPU control word setup
}
//
// Application visible function
//
// Draws a fan - must have already called gos_SetupViewport
//
void __stdcall gos_DrawFans( gos_VERTEX* Vertices, int NumVertices )
{
LOG_BLOCK("Gos3D::DrawFans");
gosASSERT( !RenderDevice && InsideBeginScene && Vertices && NumVertices>=3 );
if( DirtyStates )
FlushRenderStates();
#ifdef _ARMOR
CheckVertices( Vertices, NumVertices );
#endif
#ifdef LAB_ONLY
if( gDisablePrimitives && !InDebugger )
return;
PrimitivesRendered+=NumVertices-2;
FanLength+=NumVertices-2;
FanCalls++;
if( RenderMode )
{
for( int t0=0; t0<NumVertices-2; t0++ )
{
DebugTriangle( &Vertices[t0+1], &Vertices[t0+2], &Vertices[0] );
}
return;
}
#endif
SafeFPU(); // Make sure exceptions cannot be generated
wDrawPrimitive( d3dDevice7, D3DPT_TRIANGLEFAN, D3DFVF_TLVERTEX, Vertices, NumVertices, 0 );
GameOSFPU(); // Restore current GameOS FPU control word setup
}
//
// Application visible function
//
// This API allows you to pass an array of indices and an array of vertices to be rendered.
//
// The x,y positions must be already transformed into the viewport using the constants returned
// by gos_GetViewport.
//
// The vertex colors in the array may be changed in some wireframe modes. Otherwise the data is
// not altered.
//
void __stdcall gos_RenderIndexedArray( gos_VERTEX* pVertexArray, DWORD NumberVertices, WORD* lpwIndices, DWORD NumberIndices )
{
LOG_BLOCK("Gos3D::RenderIndexedArray");
gosASSERT( InsideBeginScene && NumberVertices>0 && NumberIndices>0 && (NumberIndices%3)==0 );
if( RenderDevice )
{
RenderDevice->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, pVertexArray, NumberVertices, lpwIndices, NumberIndices, 0 );
return;
}
if( DirtyStates )
FlushRenderStates();
#ifdef _ARMOR
if( gShowVertexData ) // Use ^Break debugger to enable (show vertex data)
{
for( int t0=0; t0<NumberIndices; t0+=3 )
{
SPEW(( GROUP_DIRECT3D, "Indices %d,%d,%d",lpwIndices[t0],lpwIndices[t0+1],lpwIndices[t0+2] ));
}
}
//
// Check only the vertices used and all the indices are valid
//
for( int t0=0; t0<NumberIndices; t0++ )
{
gosASSERT( lpwIndices[t0] < NumberVertices );
CheckVertices( &pVertexArray[lpwIndices[t0]], 1 );
}
#endif
#ifdef LAB_ONLY
if( gDisablePrimitives && !InDebugger )
return;
PrimitivesRendered+=NumberIndices/3;
IndexedTriangleLength+=NumberIndices/3;
IndexedTriangleCalls++;
if( RenderMode )
{
for( int t0=0; t0<NumberIndices; t0+=3 )
{
DebugTriangle( &pVertexArray[lpwIndices[t0]], &pVertexArray[lpwIndices[t0+1]], &pVertexArray[lpwIndices[t0+2]] );
}
return;
}
#endif
SafeFPU(); // Make sure exceptions cannot be generated
wDrawIndexedPrimitive( d3dDevice7, D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, pVertexArray, NumberVertices, lpwIndices, NumberIndices, 0 );
GameOSFPU(); // Restore current GameOS FPU control word setup
}
//
// Application visible function
//
// This API allows you to pass an array of indices and an array of vertices to be rendered.
//
// The x,y positions must be already transformed into the viewport using the constants returned
// by gos_GetViewport.
//
// The vertex colors in the array may be changed in some wireframe modes. Otherwise the data is
// not altered.
//
void __stdcall gos_RenderIndexedArray( gos_VERTEX_2UV* pVertexArray, DWORD NumberVertices, WORD* lpwIndices, DWORD NumberIndices )
{
LOG_BLOCK("Gos3D::RenderIndexedArray(2UV)");
gosASSERT( !RenderDevice && InsideBeginScene && NumberVertices>0 && NumberIndices>0 && (NumberIndices%3)==0 );
if( DirtyStates )
FlushRenderStates();
#ifdef _ARMOR
//
// Check only the vertices used and all the indices are valid
//
for( int t0=0; t0<NumberIndices; t0++ )
{
gosASSERT( lpwIndices[t0] < NumberVertices );
CheckVertices2( &pVertexArray[lpwIndices[t0]], 1 );
}
#endif
#ifdef LAB_ONLY
if( gDisablePrimitives && !InDebugger )
return;
PrimitivesRendered+=NumberIndices/3;
IndexedTriangleLength+=NumberIndices/3;
IndexedTriangleCalls++;
if( RenderMode )
{
for( int t0=0; t0<NumberIndices; t0+=3 )
{
DebugTriangle_2UV( &pVertexArray[lpwIndices[t0]], &pVertexArray[lpwIndices[t0+1]], &pVertexArray[lpwIndices[t0+2]] );
}
return;
}
#endif
SafeFPU(); // Make sure exceptions cannot be generated
wDrawIndexedPrimitive( d3dDevice7, D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX2, pVertexArray, NumberVertices, lpwIndices, NumberIndices, 0 );
GameOSFPU(); // Restore current GameOS FPU control word setup
}
//
// Application visible function
//
// This API allows you to pass an array of indices and an array of vertices to be rendered.
//
// The x,y positions must be already transformed into the viewport using the constants returned
// by gos_GetViewport.
//
// The vertex colors in the array may be changed in some wireframe modes. Otherwise the data is
// not altered.
//
void __stdcall gos_RenderIndexedArray( gos_VERTEX_3UV* pVertexArray, DWORD NumberVertices, WORD* lpwIndices, DWORD NumberIndices )
{
LOG_BLOCK("Gos3D::RenderIndexedArray(3UV)");
gosASSERT( !RenderDevice && InsideBeginScene && NumberVertices>0 && NumberIndices>0 && (NumberIndices%3)==0 );
if( DirtyStates )
FlushRenderStates();
#ifdef _ARMOR
//
// Check only the vertices used and all the indices are valid
//
for( int t0=0; t0<NumberIndices; t0++ )
{
gosASSERT( lpwIndices[t0] < NumberVertices );
CheckVertices3( &pVertexArray[lpwIndices[t0]], 1 );
}
#endif
#ifdef LAB_ONLY
if( gDisablePrimitives && !InDebugger )
return;
PrimitivesRendered+=NumberIndices/3;
IndexedTriangleLength+=NumberIndices/3;
IndexedTriangleCalls++;
if( RenderMode )
{
for( int t0=0; t0<NumberIndices; t0+=3 )
{
DebugTriangle_3UV( &pVertexArray[lpwIndices[t0]], &pVertexArray[lpwIndices[t0+1]], &pVertexArray[lpwIndices[t0+2]] );
}
return;
}
#endif
SafeFPU(); // Make sure exceptions cannot be generated
wDrawIndexedPrimitive( d3dDevice7, D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX3, pVertexArray, NumberVertices, lpwIndices, NumberIndices, 0 );
GameOSFPU(); // Restore current GameOS FPU control word setup
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,226 @@
#pragma once
//===========================================================================//
// File: 3DRasterizer.hpp //
// Project: GameOS //
// Contents: Low level 3D rasterizer //
//---------------------------------------------------------------------------//
// Date Who Modification //
// 04/14/98 AG Created //
// //
//---------------------------------------------------------------------------//
// Copyright (C) 1999 Microsoft Corp. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
typedef struct _SAVESTATE
{
_SAVESTATE* pNext;
DWORD SaveState[gos_MaxState];
} SAVESTATE;
extern SAVESTATE* pStateStack;
extern DWORD StackDepth;
//
// Structure to hold information about vertex buffers created
//
typedef struct _VertexBuffer
{
DWORD Magic; // Magic number to verify handle valid
gosVERTEXTYPE VertexType; // Type of vertex the buffer contains
_VertexBuffer* pNext;
IDirect3DVertexBuffer7* vBuffer; // D3D handle
#ifdef LAB_ONLY
IDirect3DVertexBuffer7* DebugvBuffer; // D3D handle to a system memory vertex buffer for debugging D3DTLVERTEX data
IDirect3DVertexBuffer7* CopyvBuffer; // D3D handle to a system memory vertex buffer for debugging (Readable copy of D3DVERTEX data)
#endif
DWORD NumberVertices; // Number of vertices when created
bool Locked; // True when locked
bool WantOptimize; // True to optimize after the next unlock
bool Optimized; // True once buffer is optimized
bool Lost; // True when mode changed and buffer invalid
void* Pointer; // Pointer to start of data when locked
} VertexBuffer;
//
// Variables that effect rendering
//
extern WORD QuadIndex[192];
extern DWORD AlphaInvAlpha; // Set when alpha blend mode is AlphaInvAlpha
extern bool ViewPortChanged; // Set when game changes viewport
extern DWORD InUpdateRenderers; // True when in 'Update Renderers'
extern DWORD DrawingPolys; // Current polygon
extern DWORD gCulledTriangles; // Number of culled triangles
extern DWORD CulledMax;
extern DWORD DrawingMax; // Maximum polys to draw
extern DWORD DrawingHighest;
extern DWORD gForceNoClear;
extern DWORD VertexBuffersLocked;
extern DWORD gDisableLinesPoints;
extern DWORD gDisablePrimitives;
//
// Render to texture variables
//
void InitRenderToTexture();
void DestroyRenderToTexture();
//
// RenderStates.cpp
//
void FlushRenderStates();
extern bool DirtyStates;
extern BYTE UpdatedState[gos_MaxState];
//
// 3DRasterizer.hpp
//
void InitRenderStates();
void InitRenderer();
void Save3DState();
void Restore3DState();
void ReInit3D();
void Destroy3D();
void CheckVertices( gos_VERTEX* pVertexArray, DWORD NumberVertices, bool PointsLines=0 );
void CheckVertices2( gos_VERTEX_2UV* pVertexArray, DWORD NumberVertices );
void CheckVertices3( gos_VERTEX_3UV* pVertexArray, DWORD NumberVertices );
void DebugTriangle( gos_VERTEX* v1, gos_VERTEX* v2, gos_VERTEX* v3 );
void DebugTriangle_2UV( gos_VERTEX_2UV* v1, gos_VERTEX_2UV* v2, gos_VERTEX_2UV* v3 );
void DebugTriangle_3UV( gos_VERTEX_3UV* v1, gos_VERTEX_3UV* v2, gos_VERTEX_3UV* v3 );
DWORD GetMipmapColor( int Mipmap );
void gos_ClipDrawQuad( gos_VERTEX* pVertices );
//
// Statistics
//
extern DWORD NumSpecular;
extern DWORD NumPerspective;
extern DWORD NumAlpha;
extern DWORD NumTextured;
extern DWORD PrimitivesRendered;
extern DWORD PointsRendered;
extern DWORD LinesRendered;
extern DWORD TrianglesRendered;
extern DWORD QuadsRendered;
extern DWORD IndexedTriangleCalls;
extern float IndexedTriangleLength;
extern DWORD IndexedVBTriangleCalls;
extern float IndexedVBTriangleLength;
extern DWORD LastSpecularPrim;
extern DWORD LastPerspectivePrim;
extern DWORD LastAlphaPrim;
extern DWORD LastTexturePrim;
extern DWORD LastFilterPrim;
extern DWORD NumPointSampled;
extern DWORD NumBilinear;
extern DWORD NumTrilinear;
extern DWORD LastZComparePrim;
extern DWORD NumZCompare;
extern DWORD LastZWritePrim;
extern DWORD NumZWrite;
extern DWORD LastAlphaTestPrim;
extern DWORD NumAlphaTest;
extern DWORD LastDitheredPrim;
extern DWORD NumDithered;
extern DWORD LastCulledPrim;
extern DWORD NumCulled;
extern DWORD LastTextureAddressPrim;
extern DWORD NumWrapped;
extern DWORD NumClamped;
extern DWORD LastShadePrim;
extern DWORD NumFlat;
extern DWORD NumGouraud;
extern DWORD LastBlendPrim;
extern DWORD NumDecal;
extern DWORD NumModulate;
extern DWORD NumModulateAlpha;
extern DWORD LastMonoPrim;
extern DWORD NumMono;
extern DWORD LastFogPrim;
extern DWORD NumFog;
extern DWORD LastClipped;
extern DWORD NumGuardBandClipped;
extern DWORD NumClipped;
extern gos_VERTEX PickZoom[3];
//
// Capabilities of the mode
//
extern int HasGuardBandClipping;
extern float MinGuardBandClip; // Minimum guard band clip
extern float MaxGuardBandClip; // Maximum guard band clip
extern int HasAGP; // AGP memory available?
extern int HasSpecular; // Specular available
extern int HasDither; // Dithering available
extern int HasAntiAlias; // Can do sort independant antialias
extern int HasMipLodBias; // MipMap LOD bias can be altered
extern int HasDecal; // Can DECAL
extern int HasModulateAlpha; // Can MODULATEALPHA
extern int HasAdd; // Can ADD
extern int HasMipMap; // Can do mip mapping
extern int HasMaxUV; // There is a maximum UV coord for this render mode (and texture)
extern float MaxUCoord; // The maximum u coord (for current texture)//
extern float MinUCoord; // The minimum u coord (for current texture)// Various renderstates based on the capabilities of the current video card
extern float MaxVCoord; // The maximum v coord (for current texture)//
extern float MinVCoord; // The minimum v coord (for current texture)// Various renderstates based on the capabilities of the current video card
//
// Various modes the renderer can be in
//
typedef enum
{
Normal=0, // Normal rendering
WireframeGlobalColor, // Only wireframe, no texture, global wireframe color
WireframeGlobalTexture, // Global wireframe color ontop of texture
ExamineScene, // Examine, zoom into scene mode
ExamineMipmaps, // Examine Mipmaps mode
ExamineRenderer, // Compare with reference rasterizer
ExamineDepth, // Examine depth complexity
ExamineTriangleSize, // Examine triangle size
ExamineTriangleSize1, // Examine triangle size and only draw 1 or 2 pixel triangles
ExamineArea, // Examine an area of the screen
ExamineDrawing, // Examine scnene being drawn
ShowTriangleColors, // Show each triangle as a different color
ExamineColor, // Examine scene, show color information
ExamineMipmaps2, // Examine mipmaps using colored mipmap (alter u,v)
} RenderModeType;
extern RenderModeType RenderMode; // In a special debugger mode
extern DWORD RenderStates[gos_MaxState]; // Current User settings
extern DWORD PreviousStates[gos_MaxState]; // Previously set renderstates
//
// Various renderstates based on the capabilities of the current video card
//
extern DWORD ModeMagBiLinear; // MAG mode for Bilinear
extern DWORD ModeMinNone; // MIN mode for non filtering
extern DWORD ModeMinBiLinear; // MIN mode for bilinear
extern DWORD ModeMinTriLinear; // MIN mode for trilinear
@@ -0,0 +1,108 @@
#include "pch.hpp"
//===========================================================================//
// File: ACM.cpp //
// Project: GameOS //
// Contents: Wrappers for the Audio Compression Manager //
//---------------------------------------------------------------------------//
// Date Who Modification //
// 01/23/98 JTR Created //
// //
//---------------------------------------------------------------------------//
// Copyright (C) 1999 Microsoft Corp. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#include "ErrorHandler.hpp"
#include "DirectXDebugging.hpp"
MMRESULT wACMStreamPrepareHeader( HACMSTREAM hACMStream, ACMSTREAMHEADER *ACMHeader, DWORD fdwPrepare )
{
SPEW(( GROUP_DIRECTSOUND, "acmStreamPrepareHeader(0x%x, 0x%x, 0x%x)", hACMStream, ACMHeader,fdwPrepare));
MMRESULT result=acmStreamPrepareHeader(hACMStream,ACMHeader, fdwPrepare);
if( FAILED(result) )
PAUSE(( "FAILED (0x%x - %s) - acmStreamPrepareHeader(0x%x, 0x%x, 0x%x)",result,ErrorNumberToMessage(result),hACMStream, ACMHeader,fdwPrepare));
return result;
}
MMRESULT wACMStreamConvert( HACMSTREAM hACMStream, ACMSTREAMHEADER *ACMHeader, DWORD flags )
{
SPEW(( GROUP_DIRECTSOUND, "acmStreamConvert(0x%x, 0x%x, 0x%x)", hACMStream, ACMHeader,flags));
MMRESULT result=acmStreamConvert(hACMStream,ACMHeader, flags);
if( FAILED(result) )
PAUSE(( "FAILED (0x%x - %s) - acmStreamConvert(0x%x, 0x%x, 0x%x)",result,ErrorNumberToMessage(result),hACMStream, ACMHeader,flags));
return result;
}
MMRESULT wACMStreamUnprepareHeader( HACMSTREAM hACMStream, ACMSTREAMHEADER *ACMHeader, DWORD fdwPrepare )
{
SPEW(( GROUP_DIRECTSOUND, "acmStreamUnprepareHeader(0x%x, 0x%x, 0x%x)", hACMStream, ACMHeader,fdwPrepare));
MMRESULT result=acmStreamUnprepareHeader(hACMStream,ACMHeader, fdwPrepare);
if( FAILED(result) )
PAUSE(( "FAILED (0x%x - %s) - acmStreamUnprepareHeader(0x%x, 0x%x, 0x%x)",result,ErrorNumberToMessage(result),hACMStream, ACMHeader,fdwPrepare));
return result;
}
MMRESULT wACMStreamClose( HACMSTREAM hACMStream, DWORD flags )
{
SPEW(( GROUP_DIRECTSOUND, "acmStreamClose(0x%x, 0x%x)", hACMStream, flags));
MMRESULT result=acmStreamClose(hACMStream, flags);
if( FAILED(result) )
PAUSE(( "FAILED (0x%x - %s) - acmStreamClose(0x%x, 0x%x, 0x%x)",result,ErrorNumberToMessage(result),hACMStream, flags ));
return result;
}
MMRESULT wACMStreamOpen( LPHACMSTREAM phas, HACMDRIVER had, LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst, LPWAVEFILTER pwfltr, DWORD dwCallback, DWORD dwInstance, DWORD fdwOpen )
{
char Buffer[128];
char Buffer1[128];
SPEW(( GROUP_DIRECTSOUND, "acmStreamOpen(0x%x, 0x%x, %s, %s, 0x%x,0x%x, 0x%x, 0x%x)", phas, had, GetWaveFormat(Buffer,pwfxSrc), GetWaveFormat(Buffer1,pwfxDst), pwfltr, dwCallback, dwInstance, fdwOpen ));
MMRESULT result=acmStreamOpen(phas, had, pwfxSrc, pwfxDst, pwfltr, dwCallback, dwInstance, fdwOpen);
if( FAILED(result) )
PAUSE(( "FAILED (0x%x - %s) - acmStreamOpen(0x%x, 0x%x, %s, %s, 0x%x,0x%x, 0x%x, 0x%x)",result,ErrorNumberToMessage(result), phas, had, GetWaveFormat(Buffer,pwfxSrc), GetWaveFormat(Buffer1,pwfxDst), pwfltr, dwCallback, dwInstance, fdwOpen ));
return result;
}
MMRESULT wACMStreamSize( HACMSTREAM has, DWORD cbInput, LPDWORD pdwOutputBytes, DWORD fdwSize )
{
SPEW(( GROUP_DIRECTSOUND, "acmStreamSize(0x%x, 0x%x, 0x%x, 0x%x)", has, cbInput, pdwOutputBytes, fdwSize ));
MMRESULT result=acmStreamSize(has, cbInput, pdwOutputBytes, fdwSize);
if( FAILED(result) )
PAUSE(( "FAILED (0x%x - %s) - acmStreamSize(0x%x, 0x%x, 0x%x, 0x%x)",result,ErrorNumberToMessage(result), has, cbInput, pdwOutputBytes, fdwSize ));
return result;
}
MMRESULT wACMFormatSuggest( HACMDRIVER had, LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest )
{
char Buffer[128];
char Buffer1[128];
SPEW(( GROUP_DIRECTSOUND, "acmFormatSuggest(0x%x, %s, %s, 0x%x, 0x%x)", had, GetWaveFormat(Buffer,pwfxSrc), GetWaveFormat(Buffer1,pwfxDst), cbwfxDst, fdwSuggest ));
MMRESULT result=acmFormatSuggest(had, pwfxSrc, pwfxDst,cbwfxDst, fdwSuggest);
if( FAILED(result) )
PAUSE(( "FAILED (0x%x - %s) - acmFormatSuggest(0x%x, %s, %s, 0x%x, 0x%x)",result,ErrorNumberToMessage(result), had, GetWaveFormat(Buffer,pwfxSrc), GetWaveFormat(Buffer1,pwfxDst),cbwfxDst, fdwSuggest ));
return result;
}
@@ -0,0 +1,23 @@
#pragma once
//===========================================================================//
// File: ACM.cpp //
// Project: GameOS //
// Contents: Wrappers for the Audio Compression Manager //
//---------------------------------------------------------------------------//
// Date Who Modification //
// 01/23/98 JTR Created //
// //
//---------------------------------------------------------------------------//
// Copyright (C) 1999 Microsoft Corp. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
MMRESULT wACMStreamPrepareHeader( HACMSTREAM hACMStream, ACMSTREAMHEADER *ACMHeader, DWORD fdwPrepare );
MMRESULT wACMStreamConvert( HACMSTREAM hACMStream, ACMSTREAMHEADER *ACMHeader, DWORD flags );
MMRESULT wACMStreamUnprepareHeader( HACMSTREAM hACMStream, ACMSTREAMHEADER *ACMHeader, DWORD fdwPrepare );
MMRESULT wACMStreamClose( HACMSTREAM hACMStream, DWORD flags );
MMRESULT wACMStreamOpen( LPHACMSTREAM phas, HACMDRIVER had, LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst, LPWAVEFILTER pwfltr, DWORD dwCallback, DWORD dwInstance, DWORD fdwOpen );
MMRESULT wACMStreamSize( HACMSTREAM has, DWORD cbInput, LPDWORD pdwOutputBytes, DWORD fdwSize );
MMRESULT wACMFormatSuggest( HACMDRIVER had, LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest );
@@ -0,0 +1,260 @@
#include "pch.hpp"
//===========================================================================//
// File: Analyze.cpp //
// Project: GameOS //
// Contents: Lab Rat type analyzer //
//---------------------------------------------------------------------------//
// Date Who Modification //
// 11/02/99 AG Created //
//---------------------------------------------------------------------------//
// Copyright (C) 1999 Microsoft Corp. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#include "MemoryManager.hpp"
#include "Profiler.hpp"
#include "Debugger.hpp"
bool gAnalyzeEnable=0;
HGOSHEAP AnalyzeHeap;
AnalyzeStat* pAnalyze;
AnalyzeData* pAnalyzeDataStart;
AnalyzeData* pAnalyzeData;
AnalyzeData* pAnalyzeDataEnd;
//
// Internal analyze variables
//
DWORD AnalyzeAllRenderers;
DWORD AnalyzeGameRenderers;
DWORD AnalyzeGameLogic;
DWORD AnalyzeControls;
DWORD AnalyzeWindowsMessages;
DWORD AnalyzeScriptExecution;
DWORD AnalyzeScriptRenderers;
DWORD AnalyzeBltFlip;
DWORD AnalyzeDebugger;
DWORD AnalyzeEndScene;
DWORD AnalyzeFrameNumber;
//
// Startup analyze session
//
void InitAnalyze()
{
pAnalyze=0;
pAnalyzeData=0;
AnalyzeHeap=gos_CreateMemoryHeap( "Analyze", 0, ParentGameOSHeap );
pAnalyzeDataStart=0;
//
// Setup GameOS default analyze traces
//
AnalyzeFrameNumber=gosAddAnalyzeStatistic( "Frame Number", gos_TypeDWORD );
AnalyzeAllRenderers=gosAddAnalyzeStatistic( "All Renderers", gos_TypeRoutine );
AnalyzeGameRenderers=gosAddAnalyzeStatistic( "Game Renderers", gos_TypeRoutine );
AnalyzeGameLogic=gosAddAnalyzeStatistic( "Game Logic", gos_TypeRoutine );
AnalyzeControls=gosAddAnalyzeStatistic( "Reading Controls", gos_TypeRoutine );
AnalyzeWindowsMessages=gosAddAnalyzeStatistic( "Windows Messages", gos_TypeRoutine );
AnalyzeScriptExecution=gosAddAnalyzeStatistic( "Script Execution", gos_TypeRoutine );
AnalyzeScriptRenderers=gosAddAnalyzeStatistic( "Script Renderers", gos_TypeRoutine );
AnalyzeBltFlip=gosAddAnalyzeStatistic( "Blt/Flip time", gos_TypeRoutine );
AnalyzeDebugger=gosAddAnalyzeStatistic( "Debugger", gos_TypeRoutine );
AnalyzeEndScene=gosAddAnalyzeStatistic( "End Scene", gos_TypeRoutine );
// On by default.
// FlipAnalyze=1;
}
//
// Close down analyze session
//
void DestroyAnalyze()
{
while( pAnalyze )
{
AnalyzeStat* pTemp=pAnalyze->pNext;
gos_Free( pAnalyze );
pAnalyze=pTemp;
}
while( pAnalyzeDataStart )
{
AnalyzeData* pThis=(AnalyzeData*)pAnalyzeDataStart[8191].Value;
gos_Free( pAnalyzeDataStart );
pAnalyzeDataStart=pThis;
}
if( TraceBuffer )
{
gos_Free( TraceBuffer );
TraceBuffer=0;
}
if( LineBuffer )
{
gos_Free( LineBuffer );
LineBuffer=0;
}
if( AnalyzeHeap )
{
gos_DestroyMemoryHeap( AnalyzeHeap, true );
AnalyzeHeap = 0;
}
}
//
// Called when analyze is started or stopped
//
void RestartAnalyze()
{
if( gAnalyzeEnable )
{
pAnalyzeDataStart=pAnalyzeData=(AnalyzeData*)gos_Malloc( 8192*sizeof(AnalyzeData), AnalyzeHeap );
pAnalyzeDataEnd=pAnalyzeData+8191;
pAnalyzeData[8191].Stat=(AnalyzeStat*)TypeEndOfBlock;
pAnalyzeData[8191].Value=0;
}
else
{
while( pAnalyzeDataStart )
{
AnalyzeData* pThis=(AnalyzeData*)pAnalyzeDataStart[8191].Value;
gos_Free( pAnalyzeDataStart );
pAnalyzeDataStart=pThis;
}
pAnalyzeData=0;
}
}
//
// Add a new statistic to analyze
//
DWORD __stdcall gosAddAnalyzeStatistic( char* Name, gosAnalyzeType Type )
{
//
//
//
AnalyzeStat* pTemp=(AnalyzeStat*)gos_Malloc( sizeof(AnalyzeStat)+strlen(Name), AnalyzeHeap );
memcpy( pTemp->Name, Name, strlen(Name)+1 );
pTemp->pNext=0;
pTemp->Type=Type;
pTemp->Magic=0xF22E44BA;
//
// Find last entry
//
AnalyzeStat* pThis=pAnalyze;
if( pThis )
{
while( pThis->pNext )
{
if( 0==stricmp( Name, pThis->Name ) )
{
STOP(( "Duplicated statistic '%s'",Name ));
}
pThis=pThis->pNext;
}
pThis->pNext=pTemp;
}
else
{
pAnalyze=pTemp;
}
return (DWORD)pTemp;
}
void __stdcall gosLabRatStart( DWORD Handle )
{
if( !gAnalyzeEnable )
return;
pAnalyzeData->Stat=(AnalyzeStat*)Handle;
pAnalyzeData->TimeStamp=GetCycles();
pAnalyzeData->Value=TypeEnter;
pAnalyzeData++;
if( pAnalyzeData==pAnalyzeDataEnd )
{
pAnalyzeData->Value=(DWORD)gos_Malloc( 8192*sizeof(AnalyzeData), AnalyzeHeap );
pAnalyzeData=(AnalyzeData*)pAnalyzeData->Value;
pAnalyzeDataEnd=pAnalyzeData+8191;
pAnalyzeDataEnd->Stat=(AnalyzeStat*)TypeEndOfBlock;
pAnalyzeDataEnd->Value=0;
}
}
void __stdcall gosLabRatEnd( DWORD Handle )
{
if( !gAnalyzeEnable )
return;
pAnalyzeData->Stat=(AnalyzeStat*)Handle;
pAnalyzeData->TimeStamp=GetCycles();
pAnalyzeData->Value=TypeExit;
pAnalyzeData++;
if( pAnalyzeData==pAnalyzeDataEnd )
{
pAnalyzeData->Value=(DWORD)gos_Malloc( 8192*sizeof(AnalyzeData), AnalyzeHeap );
pAnalyzeData=(AnalyzeData*)pAnalyzeData->Value;
pAnalyzeDataEnd=pAnalyzeData+8191;
pAnalyzeDataEnd->Stat=(AnalyzeStat*)TypeEndOfBlock;
pAnalyzeDataEnd->Value=0;
}
}
void __stdcall gosLabRatSet( DWORD Handle, DWORD Value )
{
if( !gAnalyzeEnable )
return;
pAnalyzeData->Stat=(AnalyzeStat*)Handle;
pAnalyzeData->TimeStamp=GetCycles();
pAnalyzeData->Value=Value;
pAnalyzeData++;
if( pAnalyzeData==pAnalyzeDataEnd )
{
pAnalyzeData->Value=(DWORD)gos_Malloc( 8192*sizeof(AnalyzeData), AnalyzeHeap );
pAnalyzeData=(AnalyzeData*)pAnalyzeData->Value;
pAnalyzeDataEnd=pAnalyzeData+8191;
pAnalyzeDataEnd->Stat=(AnalyzeStat*)TypeEndOfBlock;
pAnalyzeDataEnd->Value=0;
}
}
void __stdcall gosLabRatSet( DWORD Handle, float Value )
{
if( !gAnalyzeEnable )
return;
pAnalyzeData->Stat=(AnalyzeStat*)Handle;
pAnalyzeData->TimeStamp=GetCycles();
pAnalyzeData->Value=*(DWORD*)&Value;
pAnalyzeData++;
if( pAnalyzeData==pAnalyzeDataEnd )
{
pAnalyzeData->Value=(DWORD)gos_Malloc( 8192*sizeof(AnalyzeData), AnalyzeHeap );
pAnalyzeData=(AnalyzeData*)pAnalyzeData->Value;
pAnalyzeDataEnd=pAnalyzeData+8191;
pAnalyzeDataEnd->Stat=(AnalyzeStat*)TypeEndOfBlock;
pAnalyzeDataEnd->Value=0;
}
}
@@ -0,0 +1,830 @@
#include "pch.hpp"
//===========================================================================//
// File: AnalyzeGUI.cpp //
// Project: GameOS //
// Contents: Lab Rat type analyzer GUI display //
//---------------------------------------------------------------------------//
// Date Who Modification //
// 11/03/99 AG Created //
//---------------------------------------------------------------------------//
// Copyright (C) 1999 Microsoft Corp. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#include "MemoryManager.hpp"
#include "Profiler.hpp"
#include "Debugger.hpp"
#include "Time.hpp"
AnalyzeData* pAnalyzeDataMax;
AnalyzeData* pAnalyzeDataMaxEnd;
AnalyzeData* FindNextData( DWORD Handle, AnalyzeData* CurrentPosition );
AnalyzeData* FindLastData( DWORD Handle, AnalyzeData* CurrentPosition );
void GenerateTraceData( DWORD Handle );
void DisplayTrace( DWORD Xpos, DWORD Ypos, DWORD Handle );
void AnalyzeLine( DWORD X1, DWORD Y1, DWORD X2, DWORD Y2, DWORD Color=0xff000000 );
void AnalyzeFlushLines();
extern DWORD gosColorTable[];
extern DWORD DoubleChr;
//
// Points to first 'frame grabbed'
//
AnalyzeData* FirstFrame;
//
// Points to last 'frame grabbed'
//
AnalyzeData* LastFrame;
//
// Length of data grabbed
//
DWORD FramesGrabbed;
__int64 CyclesGrabbed;
float SecondsGrabbed;
//
// Current display
//
bool InitedAnalyze=0; // Set to true once inited
AnalyzeData* DisplayFirst;
AnalyzeData* DisplayLast;
DWORD DisplayedFrames;
double CyclesPerPixel;
DWORD WidthOfTraces; // Width of traces
DWORD BottomOfLines; // Bottom of traces
//
// Mouse / region information
//
__int64 MouseAboveTime; // Time that mouse is above
AnalyzeData* pFrameBeforeMouse; // Frame marker before mouse position
AnalyzeData* pFrameAfterMouse; // Frame marker after mouse position
DWORD ThisTrace; // Handle to trace mouse above (or -1)
AnalyzeStat* ThisStat; // Pointer to stat structure of trace mouse above
DWORD Selecting; // Selecting with the mouse?
DWORD SelectStartX;
DWORD LeftSelect;
DWORD RightSelect; // Select region
//
// Stores the order of the handles currently displayed[0] and pointer into TraceBuffer data[1]
//
DWORD DisplayOrder[32][2]; // Up to 32 traces displayed at once
//
// 0=Off, 1=On, 2=Changed (for on/off traces) - or values
//
// One entry per pixel across the screen
//
DWORD* TraceBuffer;
DWORD* EndOfTraceBuffer;
gos_VERTEX* LineBuffer;
DWORD CurrentLine;
//
// When leaving analyze mode, clean up data
//
void DestroyAnalyzeData()
{
RestartAnalyze(); // Clear old data
InitedAnalyze=0;
if( TraceBuffer )
{
gos_Free( TraceBuffer );
TraceBuffer=0;
}
if( LineBuffer )
{
gos_Free( LineBuffer );
LineBuffer=0;
}
}
AnalyzeData* GetNext( AnalyzeData* pThis )
{
if( pThis==LastFrame )
return pThis;
pThis++;
if( pThis->Stat==(AnalyzeStat*)TypeEndOfBlock )
{
pThis=(AnalyzeData*)pThis->Value;
}
return pThis;
}
AnalyzeData* GetPrevious( AnalyzeData* pThis )
{
if( pThis==FirstFrame )
return pThis;
AnalyzeData* pTemp=pAnalyzeDataStart;
AnalyzeData* pLast=pAnalyzeDataStart;
while( pTemp!=pThis )
{
pLast=pTemp;
pTemp++;
if( pTemp->Stat==(AnalyzeStat*)TypeEndOfBlock )
{
pTemp=(AnalyzeData*)pTemp->Value;
}
}
return pLast;
}
// return (double)(GetCycles()-StartCount)/frequency;
void DoAnalyzeMode()
{
//
// Stop getting analyze data when in analyze mode!
//
if( !InitedAnalyze )
{
pAnalyzeDataMax=pAnalyzeData;
pAnalyzeDataMaxEnd=pAnalyzeDataEnd;
gAnalyzeEnable=0;
//
// Find first/Last frame grabbed (ignore data after last frame - it's not a complete frame!)
//
FirstFrame=FindNextData( AnalyzeFrameNumber, pAnalyzeDataStart );
LastFrame=FindLastData( AnalyzeFrameNumber, pAnalyzeDataMax );
//
// No data grabbed?
//
if( 0==FirstFrame || 0==LastFrame )
STOP(( "Invalid data" ));
//
// Work out frames / times grabbed
//
FramesGrabbed=LastFrame->Value-FirstFrame->Value;
CyclesGrabbed=LastFrame->TimeStamp-FirstFrame->TimeStamp;
SecondsGrabbed=(float)(CyclesGrabbed/frequency);
//
// Work out first frame to view
//
DisplayFirst=FirstFrame;
DisplayLast=LastFrame;
//
// Work out initial display order (from order of activated traces)
//
memset( DisplayOrder, 0, sizeof(DisplayOrder) );
DWORD Current=0;
AnalyzeData* pThis=FirstFrame;
while( Current<32 ) // Record first 32 traces to be activated
{
if( pThis==DisplayLast )
break;
DWORD CurrentHandle=(DWORD)pThis->Stat;
if( CurrentHandle==TypeEndOfBlock ) // Moved to next analyze block of data?
{
pThis=(AnalyzeData*)pThis->Value;
CurrentHandle=(DWORD)pThis->Stat;
}
if( CurrentHandle!=2323 ) //AnalyzeFrameNumber ) // Frame number is an internal trace
{
for( int t0=0; t0!=Current; t0++ )
{
if( CurrentHandle==DisplayOrder[t0][0] ) // If duplicate, ignore
break;
}
DisplayOrder[t0][0]=CurrentHandle;
if( t0==Current )
Current++;
}
pThis++;
//
// Clear variables
//
LeftSelect=0;
RightSelect=0;
}
//
// Reserve memory for trace buffer storage (maximum screen width)
//
TraceBuffer=(DWORD*)gos_Malloc( 1600*4*32, AnalyzeHeap );
//
// Reserve memory for line buffer
//
LineBuffer=(gos_VERTEX*)gos_Malloc( 200*sizeof(gos_VERTEX), AnalyzeHeap );
CurrentLine=0;
//
// Do not init these variables again
//
InitedAnalyze=1;
}
//
// Calculate information scaling
//
DisplayedFrames=DisplayLast->Value-DisplayFirst->Value;
CyclesPerPixel=double(DisplayLast->TimeStamp-DisplayFirst->TimeStamp) / double(Environment.screenWidth-120);
WidthOfTraces=Environment.screenWidth-120;
//
// Display title in large letters
//
InitTextDisplay();
CurrentX=Environment.screenWidth/2-(7*6);
CurrentY=1;
DbChrY=0;
DbChrX=0;
DbMaxX=80;
DbMaxY=80;
DoubleChr=1;
DrawText( 0xffffff, "ANALYZE" );
DoubleChr=0;
//
// Display information above traces
//
InitTextDisplay();
CurrentX=10;
CurrentY=10;
DbChrY=0;
DbChrX=0;
DbMaxX=80;
DbMaxY=80;
char Buffer[64];
double Time=(double)((DisplayLast->TimeStamp-DisplayFirst->TimeStamp)/frequency);
sprintf( Buffer, "Frames=%d, Time=%5.2fs",DisplayedFrames,Time );
DrawText( 0xffffff, Buffer );
//
// Show scale at left edge
//
sprintf( Buffer, "Frame=% 7d",DisplayFirst->Value );
CurrentX=116;
CurrentY=80-9;
DrawText( 0xffffff, Buffer );
sprintf( Buffer, "Time =%7.3f",(double)(DisplayFirst->TimeStamp-StartCount)/frequency );
CurrentX=116;
CurrentY=80-17;
DrawText( 0xffffff, Buffer );
//
// Show scale at right edge
//
sprintf( Buffer, "Time =%7.3f",(double)(DisplayLast->TimeStamp-StartCount)/frequency );
CurrentX=116+WidthOfTraces-strlen(Buffer)*6;
CurrentY=80-17;
DrawText( 0xffffff, Buffer );
CurrentX=116+WidthOfTraces-strlen(Buffer)*6;
CurrentY=80-9;
sprintf( Buffer, "Frame=% 7d",DisplayLast->Value );
DrawText( 0xffffff, Buffer );
//
// Generate / Display traces
//
DWORD Ypos=80;
DWORD CurrentTrace=0;
EndOfTraceBuffer=TraceBuffer;
CurrentLine=0;
ThisTrace=-1;
gos_SetRenderState( gos_State_Clipping, 0 );
gos_SetRenderState( gos_State_ZCompare, 0 );
gos_SetRenderState( gos_State_ZWrite, 0 );
while( Ypos<Environment.screenHeight-80 && CurrentTrace<32 )
{
if( DisplayOrder[CurrentTrace][0] )
{
if( DBMouseY>=Ypos && DBMouseY<Ypos+32 && DBMouseX>=116 && DBMouseX<116+WidthOfTraces )
{
ThisTrace=CurrentTrace;
ThisStat=(AnalyzeStat*)DisplayOrder[CurrentTrace][0];
}
GenerateTraceData( CurrentTrace );
DisplayTrace( 116, Ypos, CurrentTrace );
Ypos+=32;
}
CurrentTrace++;
}
AnalyzeFlushLines();
BottomOfLines=Ypos;
//
// Check for controls
//
bool ShiftDown=KEY_FREE!=gos_GetKeyStatus(KEY_LSHIFT);
DWORD KeyPress=(gos_GetKey()>>8)&~0xff00;
MouseAboveTime=0;
pFrameBeforeMouse=0;
pFrameAfterMouse=0;
//
// Cursor inside trace region?
//
if( DBMouseY>=80 && DBMouseY<BottomOfLines && DBMouseX>=116 && DBMouseX<116+WidthOfTraces )
{
//
// Find exact time where mouse is
//
MouseAboveTime=(__int64)(DisplayFirst->TimeStamp+CyclesPerPixel*(DBMouseX-116));
//
// Find frame start before mouse position
//
pFrameBeforeMouse=pFrameAfterMouse=DisplayFirst;
while( pFrameAfterMouse->TimeStamp < MouseAboveTime )
{
pFrameBeforeMouse=pFrameAfterMouse;
pFrameAfterMouse=FindNextData( AnalyzeFrameNumber, GetNext(pFrameAfterMouse) );
}
//
// Mouse down? (Not shift mode)
//
if( ShiftDown )
{
Selecting=0;
LeftSelect=0;
RightSelect=0;
}
else
{
if( DBButtons&1 )
{
if( !Selecting ) // Start of selection?
{
Selecting=1;
SelectStartX=DBMouseX;
}
LeftSelect=SelectStartX > DBMouseX ? DBMouseX : SelectStartX;
RightSelect=SelectStartX < DBMouseX ? DBMouseX : SelectStartX;
}
else
{
Selecting=0;
}
}
}
//
// Is there a region selected currently?
//
if( LeftSelect!=RightSelect )
{
gos_SetRenderState( gos_State_Texture, 0 );
gos_SetRenderState( gos_State_TextureMapBlend, gos_BlendModulate );
gos_SetRenderState( gos_State_AlphaMode, gos_Alpha_AlphaInvAlpha );
DrawSquare( LeftSelect, 80, RightSelect-LeftSelect, BottomOfLines-80, 0x80004000 );
}
//
// Display ruler (after select region)
//
if( MouseAboveTime && ThisTrace!=-1 )
{
gos_SetRenderState( gos_State_Texture, 0 );
gos_SetRenderState( gos_State_AlphaMode, gos_Alpha_OneZero );
gos_SetRenderState( gos_State_TextureMapBlend, gos_BlendModulate );
AnalyzeLine( DBMouseX, 80, DBMouseX, BottomOfLines, 0xffffffff );
AnalyzeFlushLines();
//
// Display information about trace under mouse
//
DWORD InfoSizeX=100;
DWORD InfoSizeY=64;
DWORD InfoX=DBMouseX+10;
if( DBMouseX > 116+WidthOfTraces/2 )
InfoX=DBMouseX-InfoSizeX-1;
DWORD InfoY=DBMouseY+20;
if( DBMouseY > (BottomOfLines-80)/2+80 )
InfoY=DBMouseY-InfoSizeY-6;
gos_SetRenderState( gos_State_Texture, 0 );
gos_SetRenderState( gos_State_TextureMapBlend, gos_BlendModulate );
gos_SetRenderState( gos_State_AlphaMode, gos_Alpha_OneZero );
DrawSquare( InfoX, InfoY, InfoSizeX, InfoSizeY, 0xffffffff );
//
// Display Text in info box (inside selected region)
//
InitTextDisplay();
StartX=CurrentX=InfoX+2;
StartY=CurrentY=InfoY+2;
DbChrY=0;
DbChrX=0;
DbMaxX=InfoSizeX/6-4;
DbMaxY=InfoSizeY/8-4;
//
// Text is different based on type of trace
//
if( LeftSelect!=RightSelect && DBMouseX>=LeftSelect && DBMouseX<=RightSelect )
{
if( ThisStat->Type==gos_TypeRoutine )
{
//
// Average of in/out %in %out, Len In, Len Out
//
DrawText( 0xff000000, "Num In 123456\n"
"Num Out 123456\n"
"%%In 123%%\n"
"%%Out 123%%\n"
"Time In 123456ms\n"
"Time Out 123456ms" );
}
else
{
}
}
else
//
// Display text in info box for the current trace the mouse is above
//
{
if( ThisStat->Type==gos_TypeRoutine )
{
}
else
{
}
}
}
//
// Cursor keys left / right - move frame forwards and backwards
//
if( KeyPress==KEY_LEFT )
{
AnalyzeData* pThis=FindLastData( AnalyzeFrameNumber, GetPrevious(DisplayFirst) );
if( pThis && pThis!=DisplayLast )
DisplayFirst=pThis;
pThis=FindLastData( AnalyzeFrameNumber, GetPrevious(DisplayLast) );
if( pThis && pThis!=DisplayFirst )
DisplayLast=pThis;
}
if( KeyPress==KEY_RIGHT )
{
AnalyzeData* pThis=FindNextData( AnalyzeFrameNumber, GetNext(DisplayLast) );
if( pThis && pThis!=DisplayFirst )
DisplayLast=pThis;
pThis=FindNextData( AnalyzeFrameNumber, GetNext(DisplayFirst) );
if( pThis && pThis!=DisplayLast )
DisplayFirst=pThis;
}
if( KeyPress==KEY_HOME )
{
DisplayFirst=FindNextData( AnalyzeFrameNumber, pAnalyzeDataStart );
DisplayLast=FindNextData( AnalyzeFrameNumber, GetNext(DisplayFirst) );
}
if( KeyPress==KEY_END )
{
DisplayLast=FindLastData( AnalyzeFrameNumber, pAnalyzeDataMax );
DisplayFirst=FindLastData( AnalyzeFrameNumber, DisplayLast );
}
//
// Shift and left button OR wheel - zoom in a frame
//
if( MouseAboveTime && (ShiftDown && DBButtons&1) || DBWheelDelta>0 )
{
if( MouseAboveTime-pFrameBeforeMouse->TimeStamp > pFrameAfterMouse->TimeStamp-MouseAboveTime )
{
AnalyzeData* pThis=FindNextData( AnalyzeFrameNumber, GetNext(DisplayFirst) );
if( pThis && pThis!=DisplayLast )
DisplayFirst=pThis;
}
else
{
AnalyzeData* pThis=FindLastData( AnalyzeFrameNumber, GetPrevious(DisplayLast) );
if( pThis && pThis!=DisplayFirst )
DisplayLast=pThis;
}
}
//
// Shift and right button OR wheel - zoom out a frame
//
if( MouseAboveTime && (ShiftDown && DBButtons&2) || DBWheelDelta<0 )
{
if( MouseAboveTime-pFrameBeforeMouse->TimeStamp > pFrameAfterMouse->TimeStamp-MouseAboveTime )
{
AnalyzeData* pThis=FindLastData( AnalyzeFrameNumber, GetPrevious(DisplayFirst) );
if( pThis && pThis!=DisplayLast )
DisplayFirst=pThis;
}
else
{
AnalyzeData* pThis=FindNextData( AnalyzeFrameNumber, GetNext(DisplayLast) );
if( pThis && pThis!=DisplayFirst )
DisplayLast=pThis;
}
}
}
//
//
//
void GenerateTraceData( DWORD Trace )
{
DWORD Handle=DisplayOrder[Trace][0];
AnalyzeStat* pStat=(AnalyzeStat*)Handle;
if( pStat )
{
DisplayOrder[Trace][1]=(DWORD)EndOfTraceBuffer;
DWORD* CurrentData=EndOfTraceBuffer;
AnalyzeData* FirstValue=FindLastData( Handle, DisplayFirst );
AnalyzeData* NextValue=FindNextData( Handle, DisplayFirst );
bool Changes;
double CurrentCycles=(double)DisplayFirst->TimeStamp;
DWORD Data=pStat->Type==gos_TypeRoutine ? TypeExit : 0;
if( FirstValue )
Data=FirstValue->Value;
for( int t0=0; t0<WidthOfTraces; t0++ )
{
CurrentData[t0]=Data;
Changes=0;
while( NextValue && NextValue->TimeStamp<=CurrentCycles )
{
Data=NextValue->Value;
NextValue=FindNextData( Handle, NextValue+1 );
Changes=1;
}
if( Changes && pStat->Type==gos_TypeRoutine )
{
CurrentData[t0]=TypeEnterExit;
}
CurrentCycles+=CyclesPerPixel;
}
EndOfTraceBuffer+=WidthOfTraces;
}
}
//
//
//
void AnalyzeLine( DWORD X1, DWORD Y1, DWORD X2, DWORD Y2, DWORD Color )
{
gosASSERT( (X1<Environment.screenWidth) || (X2<Environment.screenWidth) );
LineBuffer[CurrentLine].x=(float)X1;
LineBuffer[CurrentLine].y=(float)Y1;
LineBuffer[CurrentLine].z=0;
LineBuffer[CurrentLine].u=0;
LineBuffer[CurrentLine].v=0;
LineBuffer[CurrentLine].argb=Color;
LineBuffer[CurrentLine].rhw=1.0f;
LineBuffer[CurrentLine+1].x=(float)X2;
LineBuffer[CurrentLine+1].y=(float)Y2;
LineBuffer[CurrentLine+1].z=0;
LineBuffer[CurrentLine+1].u=0;
LineBuffer[CurrentLine+1].v=0;
LineBuffer[CurrentLine+1].argb=Color;
LineBuffer[CurrentLine+1].rhw=1.0f;
CurrentLine+=2;
if( CurrentLine==200 )
AnalyzeFlushLines();
}
void AnalyzeFlushLines()
{
if( CurrentLine )
{
gos_DrawLines( LineBuffer, CurrentLine );
CurrentLine=0;
}
}
//
// Display a single trace line on the screen
//
void DisplayTrace( DWORD Xpos, DWORD Ypos, DWORD Trace )
{
DWORD* Pointer=(DWORD*)DisplayOrder[Trace][1];
DWORD RightEdge=Xpos+WidthOfTraces;
AnalyzeStat* pStat=(AnalyzeStat*)DisplayOrder[Trace][0];
if( Pointer )
{
//
// Display white box for traces
//
gos_SetRenderState( gos_State_Texture, 0 );
gos_SetRenderState( gos_State_AlphaMode, gos_Alpha_OneZero );
gos_SetRenderState( gos_State_TextureMapBlend, gos_BlendModulate );
DrawSquare( Xpos-1, Ypos, WidthOfTraces+2, 32, 0xffa0a0a0 );
//
// Display name of trace
//
InitTextDisplay();
CurrentX=1;
if( strlen(pStat->Name)<19 )
CurrentX+=(19-strlen(pStat->Name))*6-2;
CurrentY=Ypos+11;
DbChrY=0;
DbChrX=0;
DbMaxX=19;
DbMaxY=80;
DrawText( 0xffffff, pStat->Name );
gos_SetRenderState( gos_State_Texture, 0 );
gos_SetRenderState( gos_State_AlphaMode, gos_Alpha_OneZero );
gos_SetRenderState( gos_State_TextureMapBlend, gos_BlendModulate );
//
// Display trace data
//
if( pStat->Type==gos_TypeRoutine )
{
while( Xpos<RightEdge )
{
if( TypeEnterExit==*Pointer )
{
AnalyzeLine( Xpos, Ypos+5, Xpos, Ypos+26 );
Xpos++;
Pointer++;
}
else
{
DWORD StartX=Xpos++;
DWORD Level=*Pointer++;
while( *Pointer==Level && Xpos<RightEdge )
{
Pointer++;
Xpos++;
}
DWORD YLevel=Level==TypeEnter ? Ypos+5 : Ypos+25;
AnalyzeLine( StartX, YLevel, Xpos, YLevel );
}
}
}
//
// Data values - change color when values change
//
else
{
DWORD CurrentLevel=*Pointer;
while( Xpos<RightEdge )
{
Pointer++;
if( *Pointer!=CurrentLevel )
{
AnalyzeLine( Xpos, Ypos+5, Xpos, Ypos+26 );
Xpos++;
CurrentLevel=*Pointer;
}
else
{
DWORD StartX=Xpos++;
while( *Pointer==CurrentLevel && Xpos<RightEdge )
{
Pointer++;
Xpos++;
}
AnalyzeLine( StartX, Ypos+25, Xpos, Ypos+25 );
}
}
}
}
}
//
// Finds first data point for a given statistc AFTER the current position (or 0 returned)
//
AnalyzeData* FindNextData( DWORD Handle, AnalyzeData* CurrentPosition )
{
AnalyzeData* pThis=CurrentPosition;
while( pThis<pAnalyzeDataMax )
{
if( pThis->Stat==(AnalyzeStat*)Handle )
{
return pThis;
}
if( pThis->Stat==(AnalyzeStat*)TypeEndOfBlock )
{
pThis=(AnalyzeData*)pThis->Value;
}
else
{
pThis++;
}
}
return (AnalyzeData*)0;
}
//
// Finds last data point for a given statistc BEFORE the current position (or 0 returned)
//
AnalyzeData* FindLastData( DWORD Handle, AnalyzeData* CurrentPosition )
{
AnalyzeData* LastFound=0;
AnalyzeData* pThis=pAnalyzeDataStart;
while( pThis<CurrentPosition )
{
if( pThis->Stat==(AnalyzeStat*)Handle )
{
LastFound=pThis;
}
if( pThis->Stat==(AnalyzeStat*)TypeEndOfBlock )
{
pThis=(AnalyzeData*)pThis->Value;
}
else
{
pThis++;
}
}
return (AnalyzeData*)LastFound;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More