From 271d981f9c1ecc141b4e6f233a1cf1adcb3339cf Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Mon, 15 Mar 2004 00:38:35 +0000 Subject: [PATCH] debug trace + dbg input + tweaks --- Cxbx.opt | Bin 60928 -> 62976 bytes CxbxKrnl.dsp | 17 + Include/Cxbx.h | 8 +- Include/Win32/CxbxKrnl/DbgConsole.h | 61 + Source/Win32/CxbxKrnl/DbgConsole.cpp | 153 ++ Source/Win32/CxbxKrnl/Emu.cpp | 16 +- Source/Win32/CxbxKrnl/EmuD3D8.cpp | 2310 +++++++++----------------- Source/Win32/CxbxKrnl/EmuDSound.cpp | 885 ++++------ Source/Win32/CxbxKrnl/EmuFS.cpp | 17 +- Source/Win32/CxbxKrnl/EmuKrnl.cpp | 1238 +++++--------- Source/Win32/CxbxKrnl/EmuXG.cpp | 72 +- Source/Win32/CxbxKrnl/EmuXOnline.cpp | 135 +- Source/Win32/CxbxKrnl/EmuXapi.cpp | 597 +++---- 13 files changed, 2123 insertions(+), 3386 deletions(-) create mode 100644 Include/Win32/CxbxKrnl/DbgConsole.h create mode 100644 Source/Win32/CxbxKrnl/DbgConsole.cpp diff --git a/Cxbx.opt b/Cxbx.opt index 2a03d19b2eb7eddd1e52674e1ee135dabd56dea8..7b41da2815b18d6a6c52045a82fe943d731169f9 100644 GIT binary patch literal 62976 zcmeHQ3vd1NbKn=ib zU=Gj-%mr9)KEegSHNZmPT3``y9k3W!0UF+xEWyGl?ZPE zRspvHtARDZTA&%Y4Pd?X2sZ#Nz(!yba67OW*aBDE{ z><0D#T|hUm7uW~v2RI$07uN@XJAi{gA8-gb3>*RO1X%AV!e0aifX@ICU=WA`F~9^^ zZwTQq5C@I}Cx8Sn0we(oV7-$FZ6FO~fKlKSa2m)0X8_hKcJv@83n>k>Jc-bDQXo;l zV;*{p&fEX3D3tuU-+AQyrFGv@Tpu0Zhth4dE=?(L5k>nA>P0;w0CQ39FsMRtU**2b z^(d#$@fG}sJ1dShlx~5oG)iM0uk@%#`TXuw13}B5&V}U4@4!=!qpi%shdE}Ve11>4 zY(9eIF^`pUt7Yk4w_5CoBCTLww3JPZ(GOBXeQks&JJezkGU$APN|$?wuE9< zE7l^%>}mnrgt@3XAq%^$#C1-!8-19GhdgfygPKFvpw zb=`~QF+Tpst1o|6`ix zuaCHO;_!~QYMf{ITPNM;|3`L+{sh;$|LBnGrR(<7*W5a8cuqNeRrlE%^xMN5Lk_-Y z=j(T|W{%h2{QXYXS%?1uW0=0abMX>lS%>;QhtXem>(5*>R@~U=~g>V7jPfrj%F20-|R2N^S{}q~l-G>>;Nz6;;dC}#L5au8A8UgO?<6!fTujfp2^N%|*i@p=H z;lr4%J{V}m_t+ZEM)|xx!IhN1qGz!!hkR!3ve|z>^R{cdob8ywZZZ1e$>z02yE!;IRLi&A#TjcUoLdpHfL`O6 zq&;TBjHFGriN0OUR#CqCALoicR|V4NRav2?wz0Rjtp^6xX%s#Xv4_k|XT}^USV)l! zec4pD#ghsP*gDnUXjNg6AMSxHn#8Xt9JfYwp-B>N>e(M(Zp!XETQ6=3rpzK z^g6cB5*n2;6AKJ9Qn=krnaP-$jGhTw$xI}kG;Q4?U$x!JGY@hI1HynXAPfit!hkR! z3$BvnHDMdHC5i>npN^81PXnHu3 zDp_hSvq+|7W;MvHrBrD%oYG8GJ(?+{H>Ecd$&{>6Z7j=UQcGpRb#BR=Ntx+VTGRKB zriaV3S?AOo#Fxs8m0F^aRLKIT4#F{zNykcMG{q^cl*UvTzE7bil+tn89^r=;=N??F z&%M zy8K%fsMiO5smp#H%J=$!FKf__AM6X^_Ly?tj3*u1k5urnUPwVKtG-Ur5+5d(6gx=3({C+RvW!-1Pl`$6qIIE6cjw`r5DKzt;Nt9pRAgY1yA%=c&_-4-2K?@vIu}Eq9+A z=lQ(v`LWFV2(jM$7u-rHe1@t@zrvIxBeNpo{d+^jNAI))+E)&id!nJ?b}4LRMtdL;k#aPz`+6jpyY7 zwyO?horb)C44$t3CH1U&@r)b41o98)Z>Z+1D~BN8s+!dcry!@uXo8$n8TH<%E3bsS zPTj74?{lvHYRHGwQ8g_m-v)U=#ndx*x$)~EzocGK-_1fs`L{#ft@f+Wqkpix4f0A_ zL%)sqDUPh@A@z_tj`HvtA-;m{LHquIWz=UI)>(ZJ?VIk!SJ6(jQ~j&$>hn0+D%wc* zV?O?rpRj%ny@vCZw9an|ol>XN;*6GSX^YyTe&)$jX-EyJ-JV=WN725!Jb4<$(7s2# z{H9Zn>QUU!-TKWyYu3;Y&*}VU(!=Uu^}AmBSx$R)csWp#_zdXi@#^ zdn^8R9SA7NjgZtk$T1cTdN9=+CZvJ)Ko&mF>lc=scVs4W4`hom1!3*FF6k=`MAb z>cjJIc%JKf6Wy=wSMPfIOX)s!pL&4fzs>PY^niLmHL-k_Yz)T&z5gXqr<3pl@3^o)8&eHHJYE8j{_ zs3+8BFMc&WrJhp%>BX<1FRL%BxnBHQdQv^920gi%o>ot*zwq>LqYLVSy3do>(c|iI z_4jz*E}!e^uW%CjhbwQOzsC8;UVIDv5a$+8-bicI8Wr>8O|(|6Rf|0Nc3Q1gtGDod zXh?DUHd9Ka)P64Ck+)DUl{Tmi>ZB*P z(MGjV?epX?wWt;~!;{--y;`rH@Z=8Kq&BHH@jY_eyMvCXBWf+aN3Oh+`c=Q0;mNz` zPIagHwx{1oht*-#=E=J$q9W=MPu@dO6;*Lh?xI08sPy>%1?>OZ)3dj0ybo}?_5+Qd z2~ae}0-d6eKd_J&aNcDJih2V1pOJT}4}~}NV?M%=9T_p$jg;>1jz?`PZ5_)PhX$>z z(c8YKzc(_H;wZk+ztfJShU3w6zw1MC?fCr%d%NO8!=PsaaiTfeOT?D{so`5kwUHyvtz{NdHI|C{*# z#Q(?rTKs?F{}cb8`2WQJr~QGG!~duEANa68VCpb#LGL{fbpL}ME-bhILl}D$M;WV-L!j&G_|KW> zVz67az`}1uy_*GQY!;kgTEqidbgek9p4TYet3>?2moJRxTSo4qtbQl{--4_31#@ZS z{88fn&9?minRpu1w^hcKBJQdQa94@{*Ig!6{J(8I@+S7E+cB|d1EE;$=6gcIoQt9#QJzAREhoXYWh_#Z4m~90b!s#17iOZ`=8kVChz_ab&mCqzZ2I2 z)uguba?TmsO576WyUvg~+?}ECw%KOngpR>x4d>_bDj&SqywM#`N3g(2a>Pt#I31&! z=;iv>Xw*!nje~J35y`|Y?8xdyVqDYGNblA3qh3MRv>ku=iGm$WdA_=22 znawXmq^W7Xelc&)5m|KRw zs*gfvrmM3L>((DjSf_RVk0GkTjl#13(Gx~^*o1a>oS$E1D7<3D<;+42Yq((qY+oc39bTg^*6NF9eSyX1n$WDR+%)nw^z~U9 zawa<&|0m=Bitb$@>%a5`UT>+KB|Z1Pl`)Zv{jcoiEJ4S}iv2IQi@Wcm|A{WBB=$f4 zw^$BgKo}4PCJzH*{}cP4*#9Q4{jbKc(mf1IgxLSY{>KI>vH!V-T(SR+9S|0D6j1;x zNw8o4fyOok8cY>rRMy0eZ7TCqTBa*bz;s2K|10x<_3q*FLQTL6Rpz55^M5CgNkCdE V3*|ID<4_}$ck}L`oK|Lr&VMGF?L7-8U{?pcvy0Mdv+st%4=}g;kEsq_Kp!;<{hd6chvdgQUK@7JOHHn7uu(`xyvDf@Ey z!)Wy!>PlL;kZmo>r~8!3rmdAcHWE|0dHY;dQ+M`vXL|?2*!JT%r8`B#Eys}{ z5xt}x4fRHgc(( z3wkDkqmu4T_wkdQStz>Y^HQdmOMB6Cx^3!4Z`2DE9o;UUX41Lx*?i7)3YKMf9GaC+ z8<}#7nm(l#d^RVm8-6~Pp_f^3rWW0Dpy(HBrBj;EfK#nd4s@HAVP!0(+bO1;1;^F% z{U|+c%{xkWA)V?sEmK#z^J<~Lb0}wad#XaHlj5{2^x8k#+qXwSHfeoUg-)S?{!Z*P zuvkU6>N02;aY!ntZr0=JRKk%YvQ3ii(z+J0Qa6`l;zlNBnXYXahHm3*HkYYQJ)TSJ z)_DoT`QmU%ui_l0=By6aq>dF`y;PMtQP9nq_>rm@^j7GnD&j=W98+^&Od2pW%;(W45lk=&A~OOI|h8ih-t4 z&<^ID*Rv1cMu|_vj*Sg}q9++si;kO{OC}~_gNbQG9M$uMT(A(2R=QXqOv!Ln6*L7B}ND6++Zh9fD}?NsJ-ZWc0|{(W>n*Rqyk z&CZ6kv@&Tq?ocsjq{GER$*U}`Xi0zrr7(klRvn$%$y9Xz` z_e6H?+DuV+g7ika3tSqn;c)MV!=6slN{`o5A{AZICH^KF07{24s@kVEME63!5{YyN zkK?pq^eck~o&f0uuHxa6rWeru<|3W<<3G)sL+9lGa*?q2bX3qd=-}Sdqd!@G`X~9H zL2opv<eykFCCANITP?%joVZ;BZL$4R_1C)gm~ zfY;z_VG?h_(|CIx!tp466KouBb(LQy;tP1|@50-49Bwa;{PvA{+7H@n@)t{Hob2 z3h$d4d|NCn0dIlo*1tFsT#q(a@wGv3`$ml(M$uEK_fTJmdHrU@>k$+hL|P1OlBntt zJ?Mu~gx_qRxE{G{o;-y`dTA`tAfzFACLwL*{-{VqJ+{#uau7Xz0`;84Ju-p&t8#Df zvrfokLPrMrY6hu8_^xyDvk>dlXlxp#(|tDzSx5>hla5jE4&8x5*XHrWN~T6;1k(8emh2^F*_wf3ynE=7DD(id^gi;DmOiPUJL`bo>5 zl%xxOZ_tsR)AjnI!hR7Ykz^;lr+6IwXd3-#2wES;v$-{yry<)Z+{+g(Gw-*&-RjFt zlGOgwaM>Hn9m8EQjC<=SrlHpE(XY1Jkg-MUI`=$G( z-vvm(GwgNgb?Jja_)F|H={4z(g8aVBUXfmr?hLN~ z3VT+1R=WKo{`F6@yquT+FsRR0z4|;30FdYZHFk}Bjr{vT{$FP+<(0Cw+fV-ndqR3b zdODEz8TP33sI)UE|5^5;^rG~u026tB&oM<-K2+W&9Zv+}d@ zb3ypq>>2qP`L_YS^8EjnZ3}G+r78V0#Q%3J8j6NYRpo^20p4_&w2FYh1N?egui zfiO>hncXYjD}O2oe}~;C-zS#<>hkpOvPb1d<=+Xy|HwWse_p;W2>%m%NPb8@6NLYn zJtjXU9}mLcW2fcQ^4=i-@3VX4d*ri0_!ahP`O~r-@c#>YKz=~}UXcDOyI;OvehI)c zm*-#E4WS!C4<-=qr~3YY?F{Ve!muk|C4+*lg6@Dh2lS5VMZPNeBKb6~x4AOuH{ty`H6^Qez|*8vD_EO8j9<$1W7!2f)^Jz@VR z?EeCzM`8ab?Ei%QpD@6zwfL(I3Hv``|JTU&(YI$3_J6|uPuTxeY#fFCp8}gcVgD!W z|G1@|u>TYGf5QGx*#G(Vh;NPkU%mO)Ctzo8!Umn@MK85=V*WAt2;j4iTbqCUbCl@@ zp7SWIut&Yw9wk^w>pXH9`zug>82rmAe>>%0xBSvFO6IIoJ{cX7F=4CouVKQ=og?5- zTmKUL4A{`UK^!e@*P{GY;9O4q2Px-GJo`47euilF-^!SwI?nN&KHt87cw%axdcTes zXsWiN5tHszC$7dcZL4T&dga=+#IIlutQYUBr(oPLDlyg9hek2Alt(POjz@OTyva)5 z?>}MLb523kbY%UrzJ{!`e0-Y<#y-~N1IG5=f4|2}{I_f4;I z?D7f^H`_s;TxD4qSpJ0rxg z&h-^mVp!3!VS0LK3V`Y=7CWli8QmR)`?|V?G{~?jn>H9ON^o=GiGR?xiiL9i?Oqk@ zCv|LyA3o9U?c3s()`ZCi51X)b`0!{Go)yy`P}+o}Ev>`*<^~pv>+pV<)=h1JoD;&w zp>F#%suG(EFZ@4N{4`>Eca@JugoOXcr5#O*`QLoLvzY(Q_2BQt{BJS;Tg?B425LQ$ zwKn%%;C}-D6Zjw5I@V&G!v0g(f0Ex$VgD)YKM%m)p78%D{67l+k8idAM<4$qe66JT z_+J^sBLuL#o=XJ*tjk$9(zA=a&Bp*6p@EfBJxFfpi<%&WmAuL|@DajFf>+4T2tv53 zyrhbrOV3ZOpayxNc*~nCYyV*6n7D?+k)R~)gtv+`t zmGd5>S$0!ZtpqlI3VpDd`241>-i!5L-Z=~K2>U-_|0nGK8fZY^e**s#_+KOIV6py7 zy>)A7Y^8RzMXdiq>#n`o^A3Jd@6gULM;R&9Abv;X)BRl(Ml4j?cFzdfdmX5Yzg`dOlz`2t3?K>oI`u;7R zymwvrl#gFT+Yw!mJ^-%y?YFm98)zz$bi`0I4sW(#zo`8Z zcgcxV8@q#T^yGc%4-U&`e*K8NXyx=J`w(NdO;W#Hfj;2tsfE(nC!nJ?wwh(z+t}#^ z=th#*6VTJ+zryvzZs*4@K}ST5^yK6Jn_@FVGe@Sz6Ep@eIu0A)so})%;Pmin9|vA+ z3Ec3CP5u>&hZCqn*Bb@cc-{qzMgnNnsaM+5xKCk)oUzrsLYT0V9Ls68GLy1O z%5?lllJ`C*NfF6|wpz&MG$&aN2q%wECumJ*Cs`gNNS<=g!x2F%=u%NXXrFnjifW{S z24flxRS79s1GQ0-kIui1*3Xw8N({$UR~-T}zQp*(s`4{+3AT$f46?pPE??OD}mHbfAzQcaVa5B!8ncm&Sj zm8Dr89do*E>P=bNZMS)PI+bZwL@1wcmb`+*Y{n33KH?NImpROmyA%!>1pY7Z{|4x{ zu>TeKzrg*W z0CpydHP?lZZrhd}2@lgjfo+0TbaQ4#(fX6~IWuj|J4t83fp4_lXj03k$$B9Y#F+MZjOBXtn>mMvu@rP2(t+` z&1M*RSnXrGyyHIXce9UO>5#v8`%-^6n91~28 z|Il}<*n|dz1}>!rB&`3|h62x>^BgY63}?hhPa9T>P(Tk3ly36@K_=Z6AZ{dMwXM2mlEp`WeE)k4b*BN?4f@Y_a0C?lMaycQrEVO z9Wjda%E3)xK*b<&uGioZ6YDQN)GY3EAeMq@-)G+jnYAB0RdW??Sm86=4Th_E4x{ENR6fnis224%!Lye0Ou#AZtYOXjm*0b=^*jmg zceObsmesX6KlQhedO1%$h9%!>uDlv)E5|KmOwU{Pf`7$k#BLh5ObsoVGmC1SWd1w{ZmNaIBL3jMz@uCUA^23mUTYM;!52|*H7BG5UmHRmO8EX z23Xee8ZW+jw}dVcPb8Fa%T-3GY5mF#A>|rM88sm7rdHy@TZPRdWbE#o!1yx~t~oU%tBHZzQ&T`}vv$8w-I}oKRgY z+vA@^{gYn*WEXt-pjrb|HP&D`KY{-V{7?9QfPtX!{~+xDg#91cKkj80!}f9t^K3FK zi@7G9$a9qOZ_sI2JJz?rthWBVI1&i_PvCz7{}cG1!2bmPM_)i<6B-a2czZOk!b9oE zSFFJQ1pY^Wl)(QukSp-Nv<|z(syV`9{;!z-TSlv^dPTeN{|XC0VgHxFdhSP=nEy+D x`wn5PqRQ8;!YaQ`Cg%SN{7>M20{;{EU*!oY{J)C%zi$uzAxae*csFa{{{SNLt#kkY diff --git a/CxbxKrnl.dsp b/CxbxKrnl.dsp index c8c254d7a..c21c7fef0 100644 --- a/CxbxKrnl.dsp +++ b/CxbxKrnl.dsp @@ -254,6 +254,10 @@ SOURCE=.\Include\Cxbx.h # End Source File # Begin Source File +SOURCE=.\Include\Win32\CxbxKrnl\DbgConsole.h +# End Source File +# Begin Source File + SOURCE=.\Include\Win32\CxbxKrnl\Emu.h # End Source File # Begin Source File @@ -486,7 +490,20 @@ SOURCE=.\Source\Win32\CxbxKrnl\EmuD3D8\VertexShader.cpp # End Group # Begin Source File +SOURCE=.\Source\Win32\CxbxKrnl\DbgConsole.cpp +# End Source File +# Begin Source File + SOURCE=.\Source\Win32\CxbxKrnl\Emu.cpp + +!IF "$(CFG)" == "CxbxKrnl - Win32 Release" + +!ELSEIF "$(CFG)" == "CxbxKrnl - Win32 Debug" + +# ADD CPP /Od + +!ENDIF + # End Source File # Begin Source File diff --git a/Include/Cxbx.h b/Include/Cxbx.h index 546891afc..d5b68b56e 100644 --- a/Include/Cxbx.h +++ b/Include/Cxbx.h @@ -55,10 +55,10 @@ typedef signed short sint16; typedef signed long sint32; // define this to trace intercepted function calls -#define _DEBUG_TRACE +//#define _DEBUG_TRACE // define this to trace warnings -#define _DEBUG_WARNINGS +//#define _DEBUG_WARNINGS // version information #ifndef _DEBUG_TRACE @@ -87,9 +87,11 @@ enum DebugMode // maximum number of threads cxbx can handle #define MAXIMUM_XBOX_THREADS 256 +extern volatile bool g_bPrintfOn; + // convienance debug output macros #ifdef _DEBUG_TRACE -#define DbgPrintf printf +#define DbgPrintf if(g_bPrintfOn) printf #else inline void null_func(...) { } #define DbgPrintf null_func diff --git a/Include/Win32/CxbxKrnl/DbgConsole.h b/Include/Win32/CxbxKrnl/DbgConsole.h new file mode 100644 index 000000000..07b7ab89d --- /dev/null +++ b/Include/Win32/CxbxKrnl/DbgConsole.h @@ -0,0 +1,61 @@ +// ****************************************************************** +// * +// * .,-::::: .,:: .::::::::. .,:: .: +// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;; +// * [[[ '[[,,[[' [[[__[[\. '[[,,[[' +// * $$$ Y$$$P $$""""Y$$ Y$$$P +// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo, +// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm, +// * +// * Cxbx->Win32->CxbxKrnl->EmuD3D8->VertexShader.h +// * +// * This file is part of the Cxbx project. +// * +// * Cxbx and Cxbe are free software; you can redistribute them +// * and/or modify them under the terms of the GNU General Public +// * License as published by the Free Software Foundation; either +// * version 2 of the license, or (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have recieved a copy of the GNU General Public License +// * along with this program; see the file COPYING. +// * If not, write to the Free Software Foundation, Inc., +// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. +// * +// * (c) 2002-2003 Aaron Robinson +// * +// * All rights reserved +// * +// ****************************************************************** +#ifndef DBGCONSOLE_H +#define DBGCONSOLE_H + +#include "Cxbx.h" + +// debug console input +class DbgConsole +{ + public: + DbgConsole(); + ~DbgConsole(); + + // process commands + void Process(); + + // parse an individual command + void ParseCommand(); + + // reset input buffer & display prompt + void Reset(); + + private: + // keyboard buffer + char m_szInput[1024]; + uint m_cur; +}; + +#endif diff --git a/Source/Win32/CxbxKrnl/DbgConsole.cpp b/Source/Win32/CxbxKrnl/DbgConsole.cpp new file mode 100644 index 000000000..6bf22ba44 --- /dev/null +++ b/Source/Win32/CxbxKrnl/DbgConsole.cpp @@ -0,0 +1,153 @@ +// ****************************************************************** +// * +// * .,-::::: .,:: .::::::::. .,:: .: +// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;; +// * [[[ '[[,,[[' [[[__[[\. '[[,,[[' +// * $$$ Y$$$P $$""""Y$$ Y$$$P +// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo, +// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm, +// * +// * Cxbx->Win32->CxbxKrnl->DbgConsole.cpp +// * +// * This file is part of the Cxbx project. +// * +// * Cxbx and Cxbe are free software; you can redistribute them +// * and/or modify them under the terms of the GNU General Public +// * License as published by the Free Software Foundation; either +// * version 2 of the license, or (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have recieved a copy of the GNU General Public License +// * along with this program; see the file COPYING. +// * If not, write to the Free Software Foundation, Inc., +// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. +// * +// * (c) 2002-2004 Aaron Robinson +// * Kingofc +// * +// * All rights reserved +// * +// ****************************************************************** +#define _CXBXKRNL_INTERNAL +#define _XBOXKRNL_DEFEXTRN_ + +#include "Emu.h" +#include "DbgConsole.h" + +#include + +// prevent name collisions +namespace XTL +{ + #include "EmuXTL.h" +}; + +extern XTL::LPDIRECT3DDEVICE8 g_pD3DDevice8; // Direct3D8 Device + +DbgConsole::DbgConsole() +{ + m_cur = 0; + + printf("CxbxDbg> "); + fflush(stdout); + + m_szInput[0] = '\0'; +} + +DbgConsole::~DbgConsole() +{ +} + +void DbgConsole::Process() +{ + // process all queued key presses + while(_kbhit()) + { + char c = _getche(); + + if(c == '\r') + { + ParseCommand(); + + printf("CxbxDbg> "); + fflush(stdout); + + m_szInput[0] = '\0'; + m_cur = 0; + } + else if(c == '\b') + { + if(m_cur > 0) + { + printf(" \b"); + + m_szInput[--m_cur] = '\0'; + } + else + { + printf(" "); + } + } + else + { + m_szInput[m_cur++] = c; + m_szInput[m_cur] = '\0'; + } + } +} + +void DbgConsole::Reset() +{ + m_cur = 0; + + fflush(stdout); + + printf("\n"); + + printf("CxbxDbg> "); + fflush(stdout); + + m_szInput[0] = '\0'; +} + +void DbgConsole::ParseCommand() +{ + printf("\n"); + + // TODO: as command list grows, turn into static string/ptr lookup + + if(stricmp(m_szInput, "help") == 0) + { + printf("CxbxDbg: \n"); + printf("CxbxDbg: Cxbx Debug Command List:\n"); + printf("CxbxDbg: \n"); + printf("CxbxDbg: HELP, H\n"); + printf("CxbxDbg: QUIT, Q, EXIT\n"); + printf("CxbxDbg: TRACE, T\n"); + printf("CxbxDbg: CLS\n"); + printf("CxbxDbg: \n"); + } + else if(stricmp(m_szInput, "cls") == 0) + { + // clear screen using system call + system("cls"); + } + else if(stricmp(m_szInput, "q") == 0 || stricmp(m_szInput, "quit") == 0 || stricmp(m_szInput, "exit") == 0) + { + printf("CxbxDbg: Goodbye...\n"); + EmuCleanup(NULL); + } + else if(stricmp(m_szInput, "t") == 0 || stricmp(m_szInput, "trace") == 0) + { + g_bPrintfOn = !g_bPrintfOn; + printf("CxbxDbg: Trace is now %s\n", g_bPrintfOn ? "ON" : "OFF"); + } + else + { + printf("CxbxDbg: Cmd \"%s\" not recognized!\n", m_szInput); + } +} diff --git a/Source/Win32/CxbxKrnl/Emu.cpp b/Source/Win32/CxbxKrnl/Emu.cpp index 72c5a706d..10b5ee272 100644 --- a/Source/Win32/CxbxKrnl/Emu.cpp +++ b/Source/Win32/CxbxKrnl/Emu.cpp @@ -75,6 +75,7 @@ extern HANDLE g_hUDrive = NULL; extern HANDLE g_hZDrive = NULL; extern volatile BOOL g_bEmuSuspended = FALSE; extern volatile BOOL g_bEmuException = FALSE; +extern volatile bool g_bPrintfOn = true; // global exception patching address extern uint32 g_HaloHack[4] = {0}; @@ -166,6 +167,7 @@ extern "C" CXBXKRNL_API void NTAPI EmuInit if(AllocConsole()) { freopen("CONOUT$", "wt", stdout); + freopen("CONIN$", "rt", stdin); SetConsoleTitle("Cxbx : Kernel Debug Console"); @@ -253,7 +255,7 @@ extern "C" CXBXKRNL_API void NTAPI EmuInit if(g_hCurDir == INVALID_HANDLE_VALUE) EmuCleanup("Could not map D:\\\n"); - printf("EmuMain (0x%X): CurDir := %s\n", GetCurrentThreadId(), szBuffer); + DbgPrintf("EmuMain (0x%X): CurDir := %s\n", GetCurrentThreadId(), szBuffer); } // initialize T:\ and U:\ directories @@ -339,12 +341,12 @@ extern "C" CXBXKRNL_API void NTAPI EmuInit // initialize OpenXDK emulation (non-existant for now at least) if(pLibraryVersion == 0) - printf("EmuMain (0x%X): Detected OpenXDK application...\n", GetCurrentThreadId()); + DbgPrintf("EmuMain (0x%X): Detected OpenXDK application...\n", GetCurrentThreadId()); // initialize Microsoft XDK emulation if(pLibraryVersion != 0) { - printf("EmuMain (0x%X): Detected Microsoft XDK application...\n", GetCurrentThreadId()); + DbgPrintf("EmuMain (0x%X): Detected Microsoft XDK application...\n", GetCurrentThreadId()); uint32 dwLibraryVersions = pXbeHeader->dwLibraryVersions; uint32 dwHLEEntries = HLEDataBaseSize/sizeof(HLEData); @@ -574,7 +576,7 @@ extern "C" CXBXKRNL_API void NTAPI EmuInit printf("Emu: WARNING!! Problem with ExceptionFilter\n"); } - printf("EmuMain (0x%X): Initial thread ended.\n", GetCurrentThreadId()); + DbgPrintf("EmuMain (0x%X): Initial thread ended.\n", GetCurrentThreadId()); fflush(stdout); @@ -671,7 +673,7 @@ extern "C" CXBXKRNL_API void NTAPI EmuPanic() if(EmuIsXboxFS()) EmuSwapFS(); // Win2k/XP FS - printf("EmuMain (0x%X): EmuPanic()\n", GetCurrentThreadId()); + DbgPrintf("EmuMain (0x%X): EmuPanic()\n", GetCurrentThreadId()); EmuCleanup("Kernel Panic!"); @@ -1143,9 +1145,13 @@ static void EmuInstallWrappers(OOVPATable *OovpaTable, uint32 OovpaTableSize, vo #endif if(OovpaTable[a].lpRedirect == 0) + { EmuInstallWrapper(pFunc, EmuXRefFailure); + } else + { EmuInstallWrapper(pFunc, OovpaTable[a].lpRedirect); + } } } } diff --git a/Source/Win32/CxbxKrnl/EmuD3D8.cpp b/Source/Win32/CxbxKrnl/EmuD3D8.cpp index 5868b253d..cad900c86 100644 --- a/Source/Win32/CxbxKrnl/EmuD3D8.cpp +++ b/Source/Win32/CxbxKrnl/EmuD3D8.cpp @@ -43,6 +43,7 @@ namespace xboxkrnl #include "Emu.h" #include "EmuFS.h" #include "EmuShared.h" +#include "DbgConsole.h" // prevent name collisions namespace XTL @@ -370,16 +371,20 @@ static DWORD WINAPI EmuRenderWindow(LPVOID lpVoid) if(!XTL::EmuDInputInit()) EmuCleanup("Could not initialize DirectInput!"); - printf("EmuD3D8 (0x%X): Message-Pump thread is running.\n", GetCurrentThreadId()); + DbgPrintf("EmuD3D8 (0x%X): Message-Pump thread is running.\n", GetCurrentThreadId()); SetFocus(g_hEmuWindow); + DbgConsole *dbgConsole = new DbgConsole(); + // message processing loop { MSG msg; ZeroMemory(&msg, sizeof(msg)); + bool lPrintfOn = g_bPrintfOn; + while(msg.message != WM_QUIT) { if(PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE)) @@ -390,11 +395,25 @@ static DWORD WINAPI EmuRenderWindow(LPVOID lpVoid) DispatchMessage(&msg); } else + { Sleep(10); + + // if we've just switched back to display off, clear buffer & display prompt + if(!g_bPrintfOn && lPrintfOn) + { + dbgConsole->Reset(); + } + + lPrintfOn = g_bPrintfOn; + + dbgConsole->Process(); + } } g_bRenderWindowActive = false; + delete dbgConsole; + EmuCleanup(NULL); } @@ -484,6 +503,10 @@ static LRESULT WINAPI EmuMsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar { if(wParam == VK_ESCAPE) PostMessage(hWnd, WM_CLOSE, 0, 0); + else if(wParam == VK_F8) + { + g_bPrintfOn = !g_bPrintfOn; + } else if(wParam == VK_F9) { XTL::g_bBrkPush = TRUE; @@ -573,7 +596,7 @@ static DWORD WINAPI EmuUpdateTickCount(LPVOID) // since callbacks come from here EmuGenerateFS(g_pTLS, g_pTLSData); - printf("EmuD3D8 (0x%X): Timing thread is running.\n", GetCurrentThreadId()); + DbgPrintf("EmuD3D8 (0x%X): Timing thread is running.\n", GetCurrentThreadId()); timeBeginPeriod(0); @@ -627,14 +650,14 @@ static DWORD WINAPI EmuUpdateTickCount(LPVOID) // thread dedicated to create devices static DWORD WINAPI EmuCreateDeviceProxy(LPVOID) { - printf("EmuD3D8 (0x%X): CreateDevice proxy thread is running.\n", GetCurrentThreadId()); + DbgPrintf("EmuD3D8 (0x%X): CreateDevice proxy thread is running.\n", GetCurrentThreadId()); while(true) { // if we have been signalled, create the device with cached parameters if(g_EmuCDPD.bReady) { - printf("EmuD3D8 (0x%X): CreateDevice proxy thread recieved request.\n", GetCurrentThreadId()); + DbgPrintf("EmuD3D8 (0x%X): CreateDevice proxy thread recieved request.\n", GetCurrentThreadId()); if(g_EmuCDPD.bCreate) { @@ -642,7 +665,7 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID) // TODO: ensure all surfaces are somehow cleaned up? if(g_pD3DDevice8 != 0) { - printf("EmuD3D8 (0x%X): CreateDevice proxy thread releasing old Device.\n", GetCurrentThreadId()); + DbgPrintf("EmuD3D8 (0x%X): CreateDevice proxy thread releasing old Device.\n", GetCurrentThreadId()); g_pD3DDevice8->EndScene(); @@ -734,17 +757,15 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID) // detect vertex processing capabilities if((g_D3DCaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) && g_EmuCDPD.DeviceType == XTL::D3DDEVTYPE_HAL) { - #ifdef _DEBUG_TRACE - printf("EmuD3D8 (0x%X): Using hardware vertex processing\n", GetCurrentThreadId()); - #endif + DbgPrintf("EmuD3D8 (0x%X): Using hardware vertex processing\n", GetCurrentThreadId()); + g_EmuCDPD.BehaviorFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING; g_dwVertexShaderUsage = 0; } else { - #ifdef _DEBUG_TRACE - printf("EmuD3D8 (0x%X): Using software vertex processing\n", GetCurrentThreadId()); - #endif + DbgPrintf("EmuD3D8 (0x%X): Using software vertex processing\n", GetCurrentThreadId()); + g_EmuCDPD.BehaviorFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING; g_dwVertexShaderUsage = D3DUSAGE_SOFTWAREPROCESSING; } @@ -867,7 +888,7 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID) // release direct3d if(g_pD3DDevice8 != 0) { - printf("EmuD3D8 (0x%X): CreateDevice proxy thread releasing old Device.\n", GetCurrentThreadId()); + DbgPrintf("EmuD3D8 (0x%X): CreateDevice proxy thread releasing old Device.\n", GetCurrentThreadId()); g_pD3DDevice8->EndScene(); @@ -997,22 +1018,17 @@ HRESULT WINAPI XTL::EmuIDirect3D8_CreateDevice { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3D8_CreateDevice\n" - "(\n" - " Adapter : 0x%.08X\n" - " DeviceType : 0x%.08X\n" - " hFocusWindow : 0x%.08X\n" - " BehaviorFlags : 0x%.08X\n" - " pPresentationParameters : 0x%.08X\n" - " ppReturnedDeviceInterface : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Adapter, DeviceType, hFocusWindow, - BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3D8_CreateDevice\n" + "(\n" + " Adapter : 0x%.08X\n" + " DeviceType : 0x%.08X\n" + " hFocusWindow : 0x%.08X\n" + " BehaviorFlags : 0x%.08X\n" + " pPresentationParameters : 0x%.08X\n" + " ppReturnedDeviceInterface : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Adapter, DeviceType, hFocusWindow, + BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface); // Cache parameters g_EmuCDPD.Adapter = Adapter; @@ -1053,22 +1069,17 @@ HRESULT WINAPI XTL::EmuIDirect3D8_CheckDeviceFormat { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3D8_CheckDeviceFormat\n" - "(\n" - " Adapter : 0x%.08X\n" - " DeviceType : 0x%.08X\n" - " AdapterFormat : 0x%.08X\n" - " Usage : 0x%.08X\n" - " RType : 0x%.08X\n" - " CheckFormat : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Adapter, DeviceType, AdapterFormat, - Usage, RType, CheckFormat); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3D8_CheckDeviceFormat\n" + "(\n" + " Adapter : 0x%.08X\n" + " DeviceType : 0x%.08X\n" + " AdapterFormat : 0x%.08X\n" + " Usage : 0x%.08X\n" + " RType : 0x%.08X\n" + " CheckFormat : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Adapter, DeviceType, AdapterFormat, + Usage, RType, CheckFormat); if(RType > 7) EmuCleanup("RType > 7"); @@ -1091,12 +1102,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_BeginVisibilityTest() { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_BeginVisibilityTest();\n", GetCurrentThreadId()); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_BeginVisibilityTest();\n", GetCurrentThreadId()); EmuSwapFS(); // XBox FS @@ -1113,16 +1119,11 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_EndVisibilityTest { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_EndVisibilityTest\n" - "(\n" - " Index : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Index); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_EndVisibilityTest\n" + "(\n" + " Index : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Index); EmuSwapFS(); // XBox FS @@ -1141,18 +1142,13 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_GetVisibilityTestResult { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetVisibilityTestResult\n" - "(\n" - " Index : 0x%.08X\n" - " pResult : 0x%.08X\n" - " pTimeStamp : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Index, pResult, pTimeStamp); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetVisibilityTestResult\n" + "(\n" + " Index : 0x%.08X\n" + " pResult : 0x%.08X\n" + " pTimeStamp : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Index, pResult, pTimeStamp); // TODO: actually emulate this!? @@ -1177,16 +1173,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_GetDeviceCaps { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetDeviceCaps\n" - "(\n" - " pCaps : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pCaps); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetDeviceCaps\n" + "(\n" + " pCaps : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pCaps); g_pD3D8->GetDeviceCaps(g_XBVideo.GetDisplayAdapter(), (g_XBVideo.GetDirect3DDevice() == 0) ? XTL::D3DDEVTYPE_HAL : XTL::D3DDEVTYPE_REF, pCaps); @@ -1239,17 +1230,12 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SelectVertexShader { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SelectVertexShader\n" - "(\n" - " Handle : 0x%.08X\n" - " Address : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Handle, Address); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SelectVertexShader\n" + "(\n" + " Handle : 0x%.08X\n" + " Address : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Handle, Address); if((Handle & 0x80000000)) { @@ -1276,16 +1262,11 @@ UINT WINAPI XTL::EmuIDirect3D8_GetAdapterModeCount { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3D8_GetAdapterModeCount\n" - "(\n" - " Adapter : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Adapter); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3D8_GetAdapterModeCount\n" + "(\n" + " Adapter : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Adapter); UINT ret = g_pD3D8->GetAdapterModeCount(g_XBVideo.GetDisplayAdapter()); @@ -1318,17 +1299,12 @@ HRESULT WINAPI XTL::EmuIDirect3D8_GetAdapterDisplayMode { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3D8_GetAdapterDisplayMode\n" - "(\n" - " Adapter : 0x%.08X\n" - " pMode : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Adapter, pMode); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3D8_GetAdapterDisplayMode\n" + "(\n" + " Adapter : 0x%.08X\n" + " pMode : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Adapter, pMode); // NOTE: WARNING: We should cache the "Emulated" display mode and return // This value. We can initialize the cache with the default Xbox mode data. @@ -1367,18 +1343,13 @@ HRESULT WINAPI XTL::EmuIDirect3D8_EnumAdapterModes { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3D8_EnumAdapterModes\n" - "(\n" - " Adapter : 0x%.08X\n" - " Mode : 0x%.08X\n" - " pMode : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Adapter, Mode, pMode); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3D8_EnumAdapterModes\n" + "(\n" + " Adapter : 0x%.08X\n" + " Mode : 0x%.08X\n" + " pMode : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Adapter, Mode, pMode); HRESULT hRet; @@ -1435,12 +1406,7 @@ VOID WINAPI XTL::EmuIDirect3D8_KickOffAndWaitForIdle() { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3D8_KickOffAndWaitForIdle()\n", GetCurrentThreadId()); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3D8_KickOffAndWaitForIdle()\n", GetCurrentThreadId()); // TODO: Actually do something here? @@ -1456,17 +1422,12 @@ VOID WINAPI XTL::EmuIDirect3D8_KickOffAndWaitForIdle2(DWORD dwDummy1, DWORD dwDu { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3D8_KickOffAndWaitForIdle\n" - "(\n" - " dwDummy1 : 0x%.08X\n" - " dwDummy2 : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), dwDummy1, dwDummy2); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3D8_KickOffAndWaitForIdle\n" + "(\n" + " dwDummy1 : 0x%.08X\n" + " dwDummy2 : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), dwDummy1, dwDummy2); // TODO: Actually do something here? @@ -1486,17 +1447,12 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetGammaRamp { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetGammaRamp\n" - "(\n" - " dwFlags : 0x%.08X\n" - " pRamp : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), dwFlags, pRamp); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetGammaRamp\n" + "(\n" + " dwFlags : 0x%.08X\n" + " pRamp : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), dwFlags, pRamp); // remove D3DSGR_IMMEDIATE DWORD dwPCFlags = dwFlags & (~0x00000002); @@ -1523,12 +1479,7 @@ ULONG WINAPI XTL::EmuIDirect3DDevice8_AddRef() { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_AddRef()\n", GetCurrentThreadId()); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_AddRef()\n", GetCurrentThreadId()); ULONG ret = g_pD3DDevice8->AddRef(); @@ -1544,12 +1495,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_BeginStateBlock() { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_BeginStateBlock()\n", GetCurrentThreadId()); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_BeginStateBlock()\n", GetCurrentThreadId()); ULONG ret = g_pD3DDevice8->BeginStateBlock(); @@ -1565,16 +1511,11 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CaptureStateBlock(DWORD Token) { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CaptureStateBlock\n" - "(\n" - " Token : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Token); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CaptureStateBlock\n" + "(\n" + " Token : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Token); ULONG ret = g_pD3DDevice8->CaptureStateBlock(Token); @@ -1590,16 +1531,11 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_ApplyStateBlock(DWORD Token) { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_ApplyStateBlock\n" - "(\n" - " Token : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Token); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_ApplyStateBlock\n" + "(\n" + " Token : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Token); ULONG ret = g_pD3DDevice8->ApplyStateBlock(Token); @@ -1615,16 +1551,11 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_EndStateBlock(DWORD *pToken) { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_EndStateBlock\n" - "(\n" - " pToken : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pToken); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_EndStateBlock\n" + "(\n" + " pToken : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pToken); ULONG ret = g_pD3DDevice8->EndStateBlock(pToken); @@ -1647,21 +1578,16 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CopyRects { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CopyRects\n" - "(\n" - " pSourceSurface : 0x%.08X\n" - " pSourceRectsArray : 0x%.08X\n" - " cRects : 0x%.08X\n" - " pDestinationSurface : 0x%.08X\n" - " pDestPointsArray : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pSourceSurface, pSourceRectsArray, cRects, - pDestinationSurface, pDestPointsArray); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CopyRects\n" + "(\n" + " pSourceSurface : 0x%.08X\n" + " pSourceRectsArray : 0x%.08X\n" + " cRects : 0x%.08X\n" + " pDestinationSurface : 0x%.08X\n" + " pDestPointsArray : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pSourceSurface, pSourceRectsArray, cRects, + pDestinationSurface, pDestPointsArray); HRESULT hRet = g_pD3DDevice8->CopyRects ( @@ -1690,19 +1616,14 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreateImageSurface { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreateImageSurface\n" - "(\n" - " Width : 0x%.08X\n" - " Height : 0x%.08X\n" - " Format : 0x%.08X\n" - " ppBackBuffer : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Width, Height, Format, ppBackBuffer); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreateImageSurface\n" + "(\n" + " Width : 0x%.08X\n" + " Height : 0x%.08X\n" + " Format : 0x%.08X\n" + " ppBackBuffer : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Width, Height, Format, ppBackBuffer); *ppBackBuffer = new X_D3DSurface(); @@ -1725,16 +1646,11 @@ XTL::X_D3DSurface* WINAPI XTL::EmuIDirect3DDevice8_GetBackBuffer2 { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetBackBuffer2\n" - "(\n" - " BackBuffer : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BackBuffer); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetBackBuffer2\n" + "(\n" + " BackBuffer : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), BackBuffer); /** unsafe, somehow HRESULT hRet = S_OK; @@ -1805,7 +1721,7 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_GetBackBuffer #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetBackBuffer\n" + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetBackBuffer\n" "(\n" " BackBuffer : 0x%.08X\n" " Type : 0x%.08X\n" @@ -1831,17 +1747,12 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetViewport { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetViewport\n" - "(\n" - " pViewport : 0x%.08X (%d, %d, %d, %d, %f, %f)\n" - ");\n", - GetCurrentThreadId(), pViewport, pViewport->X, pViewport->Y, pViewport->Width, - pViewport->Height, pViewport->MinZ, pViewport->MaxZ); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetViewport\n" + "(\n" + " pViewport : 0x%.08X (%d, %d, %d, %d, %f, %f)\n" + ");\n", + GetCurrentThreadId(), pViewport, pViewport->X, pViewport->Y, pViewport->Width, + pViewport->Height, pViewport->MinZ, pViewport->MaxZ); HRESULT hRet = g_pD3DDevice8->SetViewport(pViewport); @@ -1866,16 +1777,11 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_GetViewport { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetViewport\n" - "(\n" - " pViewport : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pViewport); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetViewport\n" + "(\n" + " pViewport : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pViewport); HRESULT hRet = g_pD3DDevice8->GetViewport(pViewport); @@ -1901,17 +1807,12 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_GetViewportOffsetAndScale { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetViewportOffsetAndScale\n" - "(\n" - " pOffset : 0x%.08X\n" - " pScale : 0x%.08X\n" - ");\n", - GetCurrentThreadId(),pOffset,pScale); - } - #endif // _DEBUG_TRACE + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetViewportOffsetAndScale\n" + "(\n" + " pOffset : 0x%.08X\n" + " pScale : 0x%.08X\n" + ");\n", + GetCurrentThreadId(),pOffset,pScale); float fScaleX = 1.0f; float fScaleY = 1.0f; @@ -1919,6 +1820,7 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_GetViewportOffsetAndScale float fOffsetX = 0.5 + 1.0/32; float fOffsetY = 0.5 + 1.0/32; D3DVIEWPORT8 Viewport; + EmuSwapFS(); EmuIDirect3DDevice8_GetViewport(&Viewport); EmuSwapFS(); @@ -1959,16 +1861,11 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetShaderConstantMode { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetShaderConstantMode\n" - "(\n" - " Mode : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Mode); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetShaderConstantMode\n" + "(\n" + " Mode : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Mode); g_VertexShaderConstantMode = Mode; @@ -1987,16 +1884,11 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_Reset { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_Reset\n" - "(\n" - " pPresentationParameters : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pPresentationParameters); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_Reset\n" + "(\n" + " pPresentationParameters : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pPresentationParameters); EmuWarning("Device Reset is being utterly ignored"); @@ -2015,16 +1907,11 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_GetRenderTarget { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetRenderTarget\n" - "(\n" - " ppRenderTarget : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ppRenderTarget); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetRenderTarget\n" + "(\n" + " ppRenderTarget : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), ppRenderTarget); IDirect3DSurface8 *pSurface8 = g_pCachedRenderTarget->EmuSurface8; @@ -2032,9 +1919,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_GetRenderTarget *ppRenderTarget = g_pCachedRenderTarget; - #ifdef _DEBUG_TRACE - printf("EmuD3D8 (0x%X): RenderTarget := 0x%.08X\n", GetCurrentThreadId(), pSurface8); - #endif + DbgPrintf("EmuD3D8 (0x%X): RenderTarget := 0x%.08X\n", GetCurrentThreadId(), pSurface8); EmuSwapFS(); // Xbox FS @@ -2048,21 +1933,13 @@ XTL::X_D3DSurface * WINAPI XTL::EmuIDirect3DDevice8_GetRenderTarget2() { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetRenderTarget2()\n", - GetCurrentThreadId()); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetRenderTarget2()\n", GetCurrentThreadId()); IDirect3DSurface8 *pSurface8 = g_pCachedRenderTarget->EmuSurface8; pSurface8->AddRef(); - #ifdef _DEBUG_TRACE - printf("EmuD3D8 (0x%X): RenderTarget := 0x%.08X\n", GetCurrentThreadId(), pSurface8); - #endif + DbgPrintf("EmuD3D8 (0x%X): RenderTarget := 0x%.08X\n", GetCurrentThreadId(), pSurface8); EmuSwapFS(); // Xbox FS @@ -2079,16 +1956,11 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_GetDepthStencilSurface { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetDepthStencilSurface\n" - "(\n" - " ppZStencilSurface : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ppZStencilSurface); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetDepthStencilSurface\n" + "(\n" + " ppZStencilSurface : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), ppZStencilSurface); IDirect3DSurface8 *pSurface8 = g_pCachedZStencilSurface->EmuSurface8; @@ -2097,9 +1969,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_GetDepthStencilSurface *ppZStencilSurface = g_pCachedZStencilSurface; - #ifdef _DEBUG_TRACE - printf("EmuD3D8 (0x%X): DepthStencilSurface := 0x%.08X\n", GetCurrentThreadId(), pSurface8); - #endif + DbgPrintf("EmuD3D8 (0x%X): DepthStencilSurface := 0x%.08X\n", GetCurrentThreadId(), pSurface8); EmuSwapFS(); // Xbox FS @@ -2113,22 +1983,15 @@ XTL::X_D3DSurface * WINAPI XTL::EmuIDirect3DDevice8_GetDepthStencilSurface2() { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetDepthStencilSurface2()\n", - GetCurrentThreadId()); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetDepthStencilSurface2()\n", + GetCurrentThreadId()); IDirect3DSurface8 *pSurface8 = g_pCachedZStencilSurface->EmuSurface8; if(pSurface8 != 0) pSurface8->AddRef(); - #ifdef _DEBUG_TRACE - printf("EmuD3D8 (0x%X): DepthStencilSurface := 0x%.08X\n", GetCurrentThreadId(), pSurface8); - #endif + DbgPrintf("EmuD3D8 (0x%X): DepthStencilSurface := 0x%.08X\n", GetCurrentThreadId(), pSurface8); EmuSwapFS(); // Xbox FS @@ -2146,17 +2009,12 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_GetTile { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetTile\n" - "(\n" - " Index : 0x%.08X\n" - " pTile : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Index, pTile); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetTile\n" + "(\n" + " Index : 0x%.08X\n" + " pTile : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Index, pTile); if(pTile != NULL) memcpy(pTile, &EmuD3DTileCache[Index], sizeof(X_D3DTILE)); @@ -2177,17 +2035,12 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetTileNoWait { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTileNoWait\n" - "(\n" - " Index : 0x%.08X\n" - " pTile : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Index, pTile); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTileNoWait\n" + "(\n" + " Index : 0x%.08X\n" + " pTile : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Index, pTile); if(pTile != NULL) memcpy(&EmuD3DTileCache[Index], pTile, sizeof(X_D3DTILE)); @@ -2210,19 +2063,14 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreateVertexShader { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreateVertexShader\n" - "(\n" - " pDeclaration : 0x%.08X\n" - " pFunction : 0x%.08X\n" - " pHandle : 0x%.08X\n" - " Usage : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pDeclaration, pFunction, pHandle, Usage); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreateVertexShader\n" + "(\n" + " pDeclaration : 0x%.08X\n" + " pFunction : 0x%.08X\n" + " pHandle : 0x%.08X\n" + " Usage : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pDeclaration, pFunction, pHandle, Usage); // create emulated shader struct X_D3DVertexShader *pD3DVertexShader = new X_D3DVertexShader(); @@ -2338,18 +2186,13 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetPixelShaderConstant { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetPixelShaderConstant\n" - "(\n" - " Register : 0x%.08X\n" - " pConstantData : 0x%.08X\n" - " ConstantCount : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Register, pConstantData, ConstantCount); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetPixelShaderConstant\n" + "(\n" + " Register : 0x%.08X\n" + " pConstantData : 0x%.08X\n" + " ConstantCount : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Register, pConstantData, ConstantCount); EmuSwapFS(); // XBox FS @@ -2368,18 +2211,13 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetVertexShaderConstant { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexShaderConstant\n" - "(\n" - " Register : 0x%.08X\n" - " pConstantData : 0x%.08X\n" - " ConstantCount : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Register, pConstantData, ConstantCount); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexShaderConstant\n" + "(\n" + " Register : 0x%.08X\n" + " pConstantData : 0x%.08X\n" + " ConstantCount : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Register, pConstantData, ConstantCount); HRESULT hRet = g_pD3DDevice8->SetVertexShaderConstant ( @@ -2413,7 +2251,7 @@ VOID __fastcall XTL::EmuIDirect3DDevice8_SetVertexShaderConstant1 #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexShaderConstant1\n" + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexShaderConstant1\n" "(\n" " Register : 0x%.08X\n" " pConstantData : 0x%.08X\n" @@ -2441,7 +2279,7 @@ VOID __fastcall XTL::EmuIDirect3DDevice8_SetVertexShaderConstant4 #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexShaderConstant4\n" + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexShaderConstant4\n" "(\n" " Register : 0x%.08X\n" " pConstantData : 0x%.08X\n" @@ -2470,7 +2308,7 @@ VOID __fastcall XTL::EmuIDirect3DDevice8_SetVertexShaderConstantNotInline #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexShaderConstantNotInline\n" + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexShaderConstantNotInline\n" "(\n" " Register : 0x%.08X\n" " pConstantData : 0x%.08X\n" @@ -2497,17 +2335,12 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreatePixelShader { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreatePixelShader\n" - "(\n" - " pFunction : 0x%.08X\n" - " pHandle : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pFunction, pHandle); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreatePixelShader\n" + "(\n" + " pFunction : 0x%.08X\n" + " pHandle : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pFunction, pHandle); // redirect to windows d3d HRESULT hRet = g_pD3DDevice8->CreatePixelShader @@ -2538,16 +2371,11 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetPixelShader { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetPixelShader\n" - "(\n" - " Handle : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Handle); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetPixelShader\n" + "(\n" + " Handle : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Handle); // redirect to windows d3d HRESULT hRet = D3D_OK; @@ -2620,22 +2448,17 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreateTexture { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreateTexture\n" - "(\n" - " Width : 0x%.08X\n" - " Height : 0x%.08X\n" - " Levels : 0x%.08X\n" - " Usage : 0x%.08X\n" - " Format : 0x%.08X\n" - " Pool : 0x%.08X\n" - " ppTexture : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Width, Height, Levels, Usage, Format, Pool, ppTexture); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreateTexture\n" + "(\n" + " Width : 0x%.08X\n" + " Height : 0x%.08X\n" + " Levels : 0x%.08X\n" + " Usage : 0x%.08X\n" + " Format : 0x%.08X\n" + " Pool : 0x%.08X\n" + " ppTexture : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Width, Height, Levels, Usage, Format, Pool, ppTexture); // Convert Format (Xbox->PC) D3DFORMAT PCFormat = EmuXB2PC_D3DFormat(Format); @@ -2694,9 +2517,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreateTexture if(FAILED(hRet)) EmuWarning("CreateTexture Failed!"); - #ifdef _DEBUG_TRACE - printf("EmuD3D8 (0x%X): Created Texture : 0x%.08X (0x%.08X)\n", GetCurrentThreadId(), *ppTexture, (*ppTexture)->EmuTexture8); - #endif + DbgPrintf("EmuD3D8 (0x%X): Created Texture : 0x%.08X (0x%.08X)\n", GetCurrentThreadId(), *ppTexture, (*ppTexture)->EmuTexture8); } else { @@ -2744,23 +2565,18 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreateVolumeTexture { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreateVolumeTexture\n" - "(\n" - " Width : 0x%.08X\n" - " Height : 0x%.08X\n" - " Depth : 0x%.08X\n" - " Levels : 0x%.08X\n" - " Usage : 0x%.08X\n" - " Format : 0x%.08X\n" - " Pool : 0x%.08X\n" - " ppVolumeTexture : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Width, Height, Depth, Levels, Usage, Format, Pool, ppVolumeTexture); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreateVolumeTexture\n" + "(\n" + " Width : 0x%.08X\n" + " Height : 0x%.08X\n" + " Depth : 0x%.08X\n" + " Levels : 0x%.08X\n" + " Usage : 0x%.08X\n" + " Format : 0x%.08X\n" + " Pool : 0x%.08X\n" + " ppVolumeTexture : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Width, Height, Depth, Levels, Usage, Format, Pool, ppVolumeTexture); // Convert Format (Xbox->PC) D3DFORMAT PCFormat = EmuXB2PC_D3DFormat(Format); @@ -2851,21 +2667,16 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreateCubeTexture { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreateCubeTexture\n" - "(\n" - " EdgeLength : 0x%.08X\n" - " Levels : 0x%.08X\n" - " Usage : 0x%.08X\n" - " Format : 0x%.08X\n" - " Pool : 0x%.08X\n" - " ppCubeTexture : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), EdgeLength, Levels, Usage, Format, Pool, ppCubeTexture); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreateCubeTexture\n" + "(\n" + " EdgeLength : 0x%.08X\n" + " Levels : 0x%.08X\n" + " Usage : 0x%.08X\n" + " Format : 0x%.08X\n" + " Pool : 0x%.08X\n" + " ppCubeTexture : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), EdgeLength, Levels, Usage, Format, Pool, ppCubeTexture); // Convert Format (Xbox->PC) D3DFORMAT PCFormat = EmuXB2PC_D3DFormat(Format); @@ -2922,20 +2733,15 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreateIndexBuffer { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreateIndexBuffer\n" - "(\n" - " Length : 0x%.08X\n" - " Usage : 0x%.08X\n" - " Format : 0x%.08X\n" - " Pool : 0x%.08X\n" - " ppIndexBuffer : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Length, Usage, Format, Pool, ppIndexBuffer); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreateIndexBuffer\n" + "(\n" + " Length : 0x%.08X\n" + " Usage : 0x%.08X\n" + " Format : 0x%.08X\n" + " Pool : 0x%.08X\n" + " ppIndexBuffer : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Length, Usage, Format, Pool, ppIndexBuffer); *ppIndexBuffer = new X_D3DIndexBuffer(); @@ -2944,9 +2750,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreateIndexBuffer Length, NULL, D3DFMT_INDEX16, D3DPOOL_MANAGED, &((*ppIndexBuffer)->EmuIndexBuffer8) ); - #ifdef _DEBUG_TRACE - printf("EmuD3D8 (0x%X): EmuIndexBuffer8 := 0x%.08X\n", GetCurrentThreadId(), (*ppIndexBuffer)->EmuIndexBuffer8); - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIndexBuffer8 := 0x%.08X\n", GetCurrentThreadId(), (*ppIndexBuffer)->EmuIndexBuffer8); if(FAILED(hRet)) EmuWarning("CreateIndexBuffer Failed! (0x%.08X)", hRet); @@ -2967,17 +2771,12 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetIndices { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetIndices\n" - "(\n" - " pIndexData : 0x%.08X\n" - " BaseVertexIndex : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pIndexData, BaseVertexIndex); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetIndices\n" + "(\n" + " pIndexData : 0x%.08X\n" + " BaseVertexIndex : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pIndexData, BaseVertexIndex); /* fflush(stdout); @@ -3032,17 +2831,12 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetTexture { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTexture\n" - "(\n" - " Stage : 0x%.08X\n" - " pTexture : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Stage, pTexture); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTexture\n" + "(\n" + " Stage : 0x%.08X\n" + " pTexture : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Stage, pTexture); IDirect3DBaseTexture8 *pBaseTexture8 = NULL; @@ -3071,18 +2865,13 @@ VOID __fastcall XTL::EmuIDirect3DDevice8_SwitchTexture { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SwitchTexture\n" - "(\n" - " Method : 0x%.08X\n" - " Data : 0x%.08X\n" - " Format : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Method, Data, Format); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SwitchTexture\n" + "(\n" + " Method : 0x%.08X\n" + " Data : 0x%.08X\n" + " Format : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Method, Data, Format); EmuCleanup("EmuIDirect3DDevice8_SwitchTexture is not implemented!"); /*** @@ -3114,16 +2903,11 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_GetDisplayMode { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetDisplayMode\n" - "(\n" - " pMode : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pMode); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetDisplayMode\n" + "(\n" + " pMode : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pMode); HRESULT hRet; @@ -3176,9 +2960,7 @@ static void EmuFlushD3DIVB() memcpy(&pStreamData[i], &g_D3DIVB[r].Position.x, sizeof(XTL::D3DXVECTOR3)); i += sizeof(XTL::D3DXVECTOR3); - #ifdef _DEBUG_TRACE - printf("D3DIVB[%.02d]->Position := {%f,%f,%f}\n", r, g_D3DIVB[r].Position.x, g_D3DIVB[r].Position.y, g_D3DIVB[r].Position.z); - #endif + DbgPrintf("D3DIVB[%.02d]->Position := {%f,%f,%f}\n", r, g_D3DIVB[r].Position.x, g_D3DIVB[r].Position.y, g_D3DIVB[r].Position.z); } // append specular (D3DCOLOR) @@ -3187,9 +2969,7 @@ static void EmuFlushD3DIVB() memcpy(&pStreamData[i], &g_D3DIVB[r].dwSpecular, sizeof(DWORD)); i += sizeof(DWORD); - #ifdef _DEBUG_TRACE - printf("D3DIVB[%.02d]->dwSpecular := 0x%.08X\n", r, g_D3DIVB[r].dwSpecular); - #endif + DbgPrintf("D3DIVB[%.02d]->dwSpecular := 0x%.08X\n", r, g_D3DIVB[r].dwSpecular); } // append diffuse (D3DCOLOR) @@ -3198,9 +2978,7 @@ static void EmuFlushD3DIVB() memcpy(&pStreamData[i], &g_D3DIVB[r].dwDiffuse, sizeof(DWORD)); i += sizeof(DWORD); - #ifdef _DEBUG_TRACE - printf("D3DIVB[%.02d]->dwDiffuse := 0x%.08X\n", r, g_D3DIVB[r].dwDiffuse); - #endif + DbgPrintf("D3DIVB[%.02d]->dwDiffuse := 0x%.08X\n", r, g_D3DIVB[r].dwDiffuse); } // append normal (nx,ny,nz) @@ -3209,9 +2987,7 @@ static void EmuFlushD3DIVB() memcpy(&pStreamData[i], &g_D3DIVB[r].Normal.x, sizeof(XTL::D3DXVECTOR3)); i += sizeof(XTL::D3DXVECTOR3); - #ifdef _DEBUG_TRACE - printf("D3DIVB[%.02d]->Normal := {%f,%f,%f}\n", r, g_D3DIVB[r].Normal.x, g_D3DIVB[r].Normal.y, g_D3DIVB[r].Normal.z); - #endif + DbgPrintf("D3DIVB[%.02d]->Normal := {%f,%f,%f}\n", r, g_D3DIVB[r].Normal.x, g_D3DIVB[r].Normal.y, g_D3DIVB[r].Normal.z); } // append texcoord @@ -3221,9 +2997,7 @@ static void EmuFlushD3DIVB() memcpy(&pStreamData[i], &g_D3DIVB[r].TexCoord1.x, sizeof(XTL::D3DXVECTOR2)); i += sizeof(XTL::D3DXVECTOR2); - #ifdef _DEBUG_TRACE - printf("D3DIVB[%.02d]->Tex1 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord1.x, g_D3DIVB[r].TexCoord1.y); - #endif + DbgPrintf("D3DIVB[%.02d]->Tex1 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord1.x, g_D3DIVB[r].TexCoord1.y); break; case D3DFVF_TEX2: @@ -3232,10 +3006,8 @@ static void EmuFlushD3DIVB() memcpy(&pStreamData[i], &g_D3DIVB[r].TexCoord2.x, sizeof(XTL::D3DXVECTOR2)); i += sizeof(XTL::D3DXVECTOR2); - #ifdef _DEBUG_TRACE - printf("D3DIVB[%.02d]->Tex1 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord1.x, g_D3DIVB[r].TexCoord1.y); - printf("D3DIVB[%.02d]->Tex2 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord2.x, g_D3DIVB[r].TexCoord2.y); - #endif + DbgPrintf("D3DIVB[%.02d]->Tex1 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord1.x, g_D3DIVB[r].TexCoord1.y); + DbgPrintf("D3DIVB[%.02d]->Tex2 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord2.x, g_D3DIVB[r].TexCoord2.y); break; case D3DFVF_TEX3: @@ -3246,11 +3018,9 @@ static void EmuFlushD3DIVB() memcpy(&pStreamData[i], &g_D3DIVB[r].TexCoord3.x, sizeof(XTL::D3DXVECTOR2)); i += sizeof(XTL::D3DXVECTOR2); - #ifdef _DEBUG_TRACE - printf("D3DIVB[%.02d]->Tex1 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord1.x, g_D3DIVB[r].TexCoord1.y); - printf("D3DIVB[%.02d]->Tex2 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord2.x, g_D3DIVB[r].TexCoord2.y); - printf("D3DIVB[%.02d]->Tex3 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord3.x, g_D3DIVB[r].TexCoord3.y); - #endif + DbgPrintf("D3DIVB[%.02d]->Tex1 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord1.x, g_D3DIVB[r].TexCoord1.y); + DbgPrintf("D3DIVB[%.02d]->Tex2 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord2.x, g_D3DIVB[r].TexCoord2.y); + DbgPrintf("D3DIVB[%.02d]->Tex3 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord3.x, g_D3DIVB[r].TexCoord3.y); break; case D3DFVF_TEX4: @@ -3263,12 +3033,10 @@ static void EmuFlushD3DIVB() memcpy(&pStreamData[i], &g_D3DIVB[r].TexCoord4.x, sizeof(XTL::D3DXVECTOR2)); i += sizeof(XTL::D3DXVECTOR2); - #ifdef _DEBUG_TRACE - printf("D3DIVB[%.02d]->Tex1 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord1.x, g_D3DIVB[r].TexCoord1.y); - printf("D3DIVB[%.02d]->Tex2 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord2.x, g_D3DIVB[r].TexCoord2.y); - printf("D3DIVB[%.02d]->Tex3 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord3.x, g_D3DIVB[r].TexCoord3.y); - printf("D3DIVB[%.02d]->Tex4 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord4.x, g_D3DIVB[r].TexCoord4.y); - #endif + DbgPrintf("D3DIVB[%.02d]->Tex1 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord1.x, g_D3DIVB[r].TexCoord1.y); + DbgPrintf("D3DIVB[%.02d]->Tex2 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord2.x, g_D3DIVB[r].TexCoord2.y); + DbgPrintf("D3DIVB[%.02d]->Tex3 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord3.x, g_D3DIVB[r].TexCoord3.y); + DbgPrintf("D3DIVB[%.02d]->Tex4 := {%f,%f}\n", r, g_D3DIVB[r].TexCoord4.x, g_D3DIVB[r].TexCoord4.y); break; } @@ -3348,16 +3116,11 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_Begin { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_Begin\n" - "(\n" - " PrimitiveType : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), PrimitiveType); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_Begin\n" + "(\n" + " PrimitiveType : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), PrimitiveType); if(PrimitiveType != 7) EmuCleanup("EmuIDirect3DDevice8_End does not support primitive : %d", g_dwD3DIVBPrim); @@ -3389,7 +3152,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetVertexData2f #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexData2f >>\n" + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexData2f >>\n" "(\n" " Register : 0x%.08X\n" " a : %f\n" @@ -3417,20 +3180,15 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetVertexData4f { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexData4f\n" - "(\n" - " Register : 0x%.08X\n" - " a : %f\n" - " b : %f\n" - " c : %f\n" - " d : %f\n" - ");\n", - GetCurrentThreadId(), Register, a, b, c, d); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexData4f\n" + "(\n" + " Register : 0x%.08X\n" + " a : %f\n" + " b : %f\n" + " c : %f\n" + " d : %f\n" + ");\n", + GetCurrentThreadId(), Register, a, b, c, d); HRESULT hRet = S_OK; @@ -3584,7 +3342,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetVertexDataColor #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexDataColor >>\n" + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexDataColor >>\n" "(\n" " Register : 0x%.08X\n" " Color : 0x%.08X\n" @@ -3609,12 +3367,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_End() { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_End();\n", GetCurrentThreadId()); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_End();\n", GetCurrentThreadId()); if(g_dwD3DIVBInd != 0) EmuFlushD3DIVB(); @@ -3638,17 +3391,12 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_RunPushBuffer { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_RunPushBuffer\n" - "(\n" - " pPushBuffer : 0x%.08X\n" - " pFixup : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pPushBuffer, pFixup); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_RunPushBuffer\n" + "(\n" + " pPushBuffer : 0x%.08X\n" + " pFixup : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pPushBuffer, pFixup); XTL::EmuExecutePushBuffer(pPushBuffer, pFixup); @@ -3672,22 +3420,17 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_Clear { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_Clear\n" - "(\n" - " Count : 0x%.08X\n" - " pRects : 0x%.08X\n" - " Flags : 0x%.08X\n" - " Color : 0x%.08X\n" - " Z : %f\n" - " Stencil : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Count, pRects, Flags, - Color, Z, Stencil); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_Clear\n" + "(\n" + " Count : 0x%.08X\n" + " pRects : 0x%.08X\n" + " Flags : 0x%.08X\n" + " Color : 0x%.08X\n" + " Z : %f\n" + " Stencil : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Count, pRects, Flags, + Color, Z, Stencil); // make adjustments to parameters to make sense with windows d3d { @@ -3729,19 +3472,14 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_Present { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_Present\n" - "(\n" - " pSourceRect : 0x%.08X\n" - " pDestRect : 0x%.08X\n" - " pDummy1 : 0x%.08X\n" - " pDummy2 : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pSourceRect, pDestRect, pDummy1, pDummy2); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_Present\n" + "(\n" + " pSourceRect : 0x%.08X\n" + " pDestRect : 0x%.08X\n" + " pDummy1 : 0x%.08X\n" + " pDummy2 : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pSourceRect, pDestRect, pDummy1, pDummy2); HRESULT hRet = g_pD3DDevice8->Present(pSourceRect, pDestRect, (HWND)pDummy1, (CONST RGNDATA*)pDummy2); @@ -3768,16 +3506,11 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_Swap { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_Swap\n" - "(\n" - " Flags : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Flags); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_Swap\n" + "(\n" + " Flags : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Flags); // TODO: Ensure this flag is always the same across library versions if(Flags != 0) @@ -3801,17 +3534,12 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DResource8_Register\n" - "(\n" - " pThis : 0x%.08X\n" - " pBase : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, pBase); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DResource8_Register\n" + "(\n" + " pThis : 0x%.08X\n" + " pBase : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, pBase); HRESULT hRet = S_OK; @@ -3827,9 +3555,7 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register { case X_D3DCOMMON_TYPE_VERTEXBUFFER: { - #ifdef _DEBUG_TRACE - printf("EmuIDirect3DResource8_Register (0x%X) : Creating VertexBuffer...\n", GetCurrentThreadId()); - #endif + DbgPrintf("EmuIDirect3DResource8_Register (0x%X) : Creating VertexBuffer...\n", GetCurrentThreadId()); X_D3DVertexBuffer *pVertexBuffer = (X_D3DVertexBuffer*)pResource; @@ -3864,17 +3590,13 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register pResource->Data = (ULONG)pData; } - #ifdef _DEBUG_TRACE - printf("EmuIDirect3DResource8_Register (0x%X) : Successfully Created VertexBuffer (0x%.08X)\n", GetCurrentThreadId(), pResource->EmuVertexBuffer8); - #endif + DbgPrintf("EmuIDirect3DResource8_Register (0x%X) : Successfully Created VertexBuffer (0x%.08X)\n", GetCurrentThreadId(), pResource->EmuVertexBuffer8); } break; case X_D3DCOMMON_TYPE_INDEXBUFFER: { - #ifdef _DEBUG_TRACE - printf("EmuIDirect3DResource8_Register :-> IndexBuffer...\n"); - #endif + DbgPrintf("EmuIDirect3DResource8_Register :-> IndexBuffer...\n"); X_D3DIndexBuffer *pIndexBuffer = (X_D3DIndexBuffer*)pResource; @@ -3916,17 +3638,13 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register pResource->Data = (ULONG)pData; } - #ifdef _DEBUG_TRACE - printf("EmuIDirect3DResource8_Register (0x%X) : Successfully Created IndexBuffer (0x%.08X)\n", GetCurrentThreadId(), pResource->EmuIndexBuffer8); - #endif + DbgPrintf("EmuIDirect3DResource8_Register (0x%X) : Successfully Created IndexBuffer (0x%.08X)\n", GetCurrentThreadId(), pResource->EmuIndexBuffer8); } break; case X_D3DCOMMON_TYPE_PUSHBUFFER: { - #ifdef _DEBUG_TRACE - printf("EmuIDirect3DResource8_Register :-> PushBuffer...\n"); - #endif + DbgPrintf("EmuIDirect3DResource8_Register :-> PushBuffer...\n"); X_D3DPushBuffer *pPushBuffer = (X_D3DPushBuffer*)pResource; @@ -3947,21 +3665,17 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register pResource->Data = (ULONG)pBase; } - #ifdef _DEBUG_TRACE - printf("EmuIDirect3DResource8_Register (0x%X) : Successfully Created PushBuffer (0x%.08X, 0x%.08X, 0x%.08X)\n", GetCurrentThreadId(), pResource->Data, pPushBuffer->Size, pPushBuffer->AllocationSize); - #endif + DbgPrintf("EmuIDirect3DResource8_Register (0x%X) : Successfully Created PushBuffer (0x%.08X, 0x%.08X, 0x%.08X)\n", GetCurrentThreadId(), pResource->Data, pPushBuffer->Size, pPushBuffer->AllocationSize); } break; case X_D3DCOMMON_TYPE_SURFACE: case X_D3DCOMMON_TYPE_TEXTURE: { - #ifdef _DEBUG_TRACE if(dwCommonType == X_D3DCOMMON_TYPE_SURFACE) - printf("EmuIDirect3DResource8_Register :-> Surface...\n"); + DbgPrintf("EmuIDirect3DResource8_Register :-> Surface...\n"); else - printf("EmuIDirect3DResource8_Register :-> Texture...\n"); - #endif + DbgPrintf("EmuIDirect3DResource8_Register :-> Texture...\n"); X_D3DPixelContainer *pPixelContainer = (X_D3DPixelContainer*)pResource; @@ -4063,9 +3777,7 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register if(FAILED(hRet)) EmuCleanup("CreateImageSurface Failed!"); - #ifdef _DEBUG_TRACE - printf("EmuIDirect3DResource8_Register (0x%X) : Successfully Created ImageSurface (0x%.08X, 0x%.08X)\n", GetCurrentThreadId(), pResource, pResource->EmuSurface8); - #endif + DbgPrintf("EmuIDirect3DResource8_Register (0x%X) : Successfully Created ImageSurface (0x%.08X, 0x%.08X)\n", GetCurrentThreadId(), pResource, pResource->EmuSurface8); } else { @@ -4089,10 +3801,8 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register if(bCubemap) { - #ifdef _DEBUG_TRACE - printf("CreateCubeTexture(%d, %d, 0, %d, D3DPOOL_MANAGED, 0x%.08X)\n", dwWidth, + DbgPrintf("CreateCubeTexture(%d, %d, 0, %d, D3DPOOL_MANAGED, 0x%.08X)\n", dwWidth, dwMipMapLevels, Format, &pResource->EmuTexture8); - #endif hRet = g_pD3DDevice8->CreateCubeTexture ( @@ -4103,16 +3813,12 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register if(FAILED(hRet)) EmuCleanup("CreateCubeTexture Failed!"); - #ifdef _DEBUG_TRACE - printf("EmuIDirect3DResource8_Register (0x%X) : Successfully Created CubeTexture (0x%.08X, 0x%.08X)\n", GetCurrentThreadId(), pResource, pResource->EmuCubeTexture8); - #endif + DbgPrintf("EmuIDirect3DResource8_Register (0x%X) : Successfully Created CubeTexture (0x%.08X, 0x%.08X)\n", GetCurrentThreadId(), pResource, pResource->EmuCubeTexture8); } else { - #ifdef _DEBUG_TRACE - printf("CreateTexture(%d, %d, %d, 0, %d, D3DPOOL_MANAGED, 0x%.08X)\n", dwWidth, dwHeight, + DbgPrintf("CreateTexture(%d, %d, %d, 0, %d, D3DPOOL_MANAGED, 0x%.08X)\n", dwWidth, dwHeight, dwMipMapLevels, Format, &pResource->EmuTexture8); - #endif hRet = g_pD3DDevice8->CreateTexture ( @@ -4123,9 +3829,7 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register if(FAILED(hRet)) EmuCleanup("CreateTexture Failed!"); - #ifdef _DEBUG_TRACE - printf("EmuIDirect3DResource8_Register (0x%X) : Successfully Created Texture (0x%.08X, 0x%.08X)\n", GetCurrentThreadId(), pResource, pResource->EmuTexture8); - #endif + DbgPrintf("EmuIDirect3DResource8_Register (0x%X) : Successfully Created Texture (0x%.08X, 0x%.08X)\n", GetCurrentThreadId(), pResource, pResource->EmuTexture8); } } @@ -4281,16 +3985,11 @@ ULONG WINAPI XTL::EmuIDirect3DResource8_AddRef { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DResource8_AddRef\n" - "(\n" - " pThis : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DResource8_AddRef\n" + "(\n" + " pThis : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis); ULONG uRet = 0; @@ -4316,16 +4015,11 @@ ULONG WINAPI XTL::EmuIDirect3DResource8_Release { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DResource8_Release\n" - "(\n" - " pThis : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DResource8_Release\n" + "(\n" + " pThis : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis); ULONG uRet = 0; @@ -4364,9 +4058,8 @@ ULONG WINAPI XTL::EmuIDirect3DResource8_Release if(uRet == 0) { - #ifdef _DEBUG_TRACE - printf("EmuIDirect3DResource8_Release (0x%X): Cleaned up a Resource!\n", GetCurrentThreadId()); - #endif + DbgPrintf("EmuIDirect3DResource8_Release (0x%X): Cleaned up a Resource!\n", GetCurrentThreadId()); + delete pThis; } } @@ -4387,18 +4080,13 @@ BOOL WINAPI XTL::EmuIDirect3DResource8_IsBusy { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - /* too much output - printf("EmuD3D8 (0x%X): EmuIDirect3DResource8_IsBusy\n" - "(\n" - " pThis : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis); - //*/ - } - #endif + /* too much output + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DResource8_IsBusy\n" + "(\n" + " pThis : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis); + //*/ IDirect3DResource8 *pResource8 = pThis->EmuResource8; @@ -4419,18 +4107,13 @@ VOID WINAPI XTL::EmuGet2DSurfaceDesc { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuGet2DSurfaceDesc\n" - "(\n" - " pPixelContainer : 0x%.08X\n" - " dwLevel : 0x%.08X\n" - " pDesc : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pPixelContainer, dwLevel, pDesc); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuGet2DSurfaceDesc\n" + "(\n" + " pPixelContainer : 0x%.08X\n" + " dwLevel : 0x%.08X\n" + " pDesc : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pPixelContainer, dwLevel, pDesc); EmuVerifyResourceIsRegistered(pPixelContainer); @@ -4485,7 +4168,7 @@ VOID WINAPI XTL::EmuGet2DSurfaceDescD #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuD3D8 (0x%X): EmuGet2DSurfaceDescD\n" + DbgPrintf("EmuD3D8 (0x%X): EmuGet2DSurfaceDescD\n" "(\n" " pPixelContainer : 0x%.08X\n" " pDesc : 0x%.08X\n" @@ -4511,17 +4194,12 @@ HRESULT WINAPI XTL::EmuIDirect3DSurface8_GetDesc { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DSurface8_GetDesc\n" - "(\n" - " pThis : 0x%.08X\n" - " pDesc : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, pDesc); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DSurface8_GetDesc\n" + "(\n" + " pThis : 0x%.08X\n" + " pDesc : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, pDesc); HRESULT hRet; @@ -4588,19 +4266,14 @@ HRESULT WINAPI XTL::EmuIDirect3DSurface8_LockRect { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DSurface8_LockRect\n" - "(\n" - " pThis : 0x%.08X\n" - " pLockedRect : 0x%.08X\n" - " pRect : 0x%.08X\n" - " Flags : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, pLockedRect, pRect, Flags); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DSurface8_LockRect\n" + "(\n" + " pThis : 0x%.08X\n" + " pLockedRect : 0x%.08X\n" + " pRect : 0x%.08X\n" + " Flags : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, pLockedRect, pRect, Flags); HRESULT hRet; @@ -4652,16 +4325,11 @@ DWORD WINAPI XTL::EmuIDirect3DBaseTexture8_GetLevelCount { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DBaseTexture8_GetLevelCount\n" - "(\n" - " pThis : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DBaseTexture8_GetLevelCount\n" + "(\n" + " pThis : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis); EmuVerifyResourceIsRegistered(pThis); @@ -4717,20 +4385,15 @@ HRESULT WINAPI XTL::EmuIDirect3DTexture8_LockRect { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DTexture8_LockRect\n" - "(\n" - " pThis : 0x%.08X\n" - " Level : 0x%.08X\n" - " pLockedRect : 0x%.08X\n" - " pRect : 0x%.08X\n" - " Flags : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, Level, pLockedRect, pRect, Flags); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DTexture8_LockRect\n" + "(\n" + " pThis : 0x%.08X\n" + " Level : 0x%.08X\n" + " pLockedRect : 0x%.08X\n" + " pRect : 0x%.08X\n" + " Flags : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, Level, pLockedRect, pRect, Flags); HRESULT hRet; @@ -4779,18 +4442,13 @@ HRESULT WINAPI XTL::EmuIDirect3DTexture8_GetSurfaceLevel { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DTexture8_GetSurfaceLevel\n" - "(\n" - " pThis : 0x%.08X\n" - " Level : 0x%.08X\n" - " ppSurfaceLevel : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, Level, ppSurfaceLevel); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DTexture8_GetSurfaceLevel\n" + "(\n" + " pThis : 0x%.08X\n" + " Level : 0x%.08X\n" + " ppSurfaceLevel : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, Level, ppSurfaceLevel); HRESULT hRet; @@ -4823,12 +4481,10 @@ HRESULT WINAPI XTL::EmuIDirect3DTexture8_GetSurfaceLevel hRet = pTexture8->GetSurfaceLevel(Level, &((*ppSurfaceLevel)->EmuSurface8)); - #ifdef _DEBUG_TRACE if(!FAILED(hRet)) { - printf("EmuD3D8 (0x%X): EmuIDirect3DTexture8_GetSurfaceLevel := 0x%.08X\n", GetCurrentThreadId(), (*ppSurfaceLevel)->EmuSurface8); + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DTexture8_GetSurfaceLevel := 0x%.08X\n", GetCurrentThreadId(), (*ppSurfaceLevel)->EmuSurface8); } - #endif } EmuSwapFS(); // XBox FS @@ -4850,20 +4506,15 @@ HRESULT WINAPI XTL::EmuIDirect3DVolumeTexture8_LockBox { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DVolumeTexture8_LockBox\n" - "(\n" - " pThis : 0x%.08X\n" - " Level : 0x%.08X\n" - " pLockedVolume : 0x%.08X\n" - " pBox : 0x%.08X\n" - " Flags : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, Level, pLockedVolume, pBox, Flags); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DVolumeTexture8_LockBox\n" + "(\n" + " pThis : 0x%.08X\n" + " Level : 0x%.08X\n" + " pLockedVolume : 0x%.08X\n" + " pBox : 0x%.08X\n" + " Flags : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, Level, pLockedVolume, pBox, Flags); EmuVerifyResourceIsRegistered(pThis); @@ -4894,21 +4545,16 @@ HRESULT WINAPI XTL::EmuIDirect3DCubeTexture8_LockRect { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DCubeTexture8_LockRect\n" - "(\n" - " pThis : 0x%.08X\n" - " FaceType : 0x%.08X\n" - " Level : 0x%.08X\n" - " pLockedBox : 0x%.08X\n" - " pRect : 0x%.08X\n" - " Flags : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, FaceType, Level, pLockedBox, pRect, Flags); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DCubeTexture8_LockRect\n" + "(\n" + " pThis : 0x%.08X\n" + " FaceType : 0x%.08X\n" + " Level : 0x%.08X\n" + " pLockedBox : 0x%.08X\n" + " pRect : 0x%.08X\n" + " Flags : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, FaceType, Level, pLockedBox, pRect, Flags); EmuVerifyResourceIsRegistered(pThis); @@ -4928,12 +4574,7 @@ ULONG WINAPI XTL::EmuIDirect3DDevice8_Release() { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_Release();\n", GetCurrentThreadId()); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_Release();\n", GetCurrentThreadId()); // Signal proxy thread, and wait for completion g_EmuCDPD.bReady = true; @@ -4974,16 +4615,11 @@ XTL::X_D3DVertexBuffer* WINAPI XTL::EmuIDirect3DDevice8_CreateVertexBuffer2 { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreateVertexBuffer2\n" - "(\n" - " Length : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Length); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreateVertexBuffer2\n" + "(\n" + " Length : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Length); X_D3DVertexBuffer *pD3DVertexBuffer = new X_D3DVertexBuffer(); @@ -5014,16 +4650,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_EnableOverlay { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_EnableOverlay\n" - "(\n" - " Enable : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Enable); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_EnableOverlay\n" + "(\n" + " Enable : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Enable); if(Enable == FALSE && g_pDDSOverlay7 != NULL) { @@ -5094,20 +4725,15 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_UpdateOverlay { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_UpdateOverlay\n" - "(\n" - " pSurface : 0x%.08X\n" - " SrcRect : 0x%.08X\n" - " DstRect : 0x%.08X\n" - " EnableColorKey : 0x%.08X\n" - " ColorKey : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pSurface, SrcRect, DstRect, EnableColorKey, ColorKey); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_UpdateOverlay\n" + "(\n" + " pSurface : 0x%.08X\n" + " SrcRect : 0x%.08X\n" + " DstRect : 0x%.08X\n" + " EnableColorKey : 0x%.08X\n" + " ColorKey : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pSurface, SrcRect, DstRect, EnableColorKey, ColorKey); // manually copy data over to overlay if(g_bSupportsYUY2) @@ -5281,13 +4907,8 @@ BOOL WINAPI XTL::EmuIDirect3DDevice8_GetOverlayUpdateStatus() { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetOverlayUpdateStatus();\n", - GetCurrentThreadId()); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetOverlayUpdateStatus();\n", + GetCurrentThreadId()); EmuSwapFS(); // XBox FS @@ -5302,13 +4923,8 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_BlockUntilVerticalBlank() { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_BlockUntilVerticalBlank();\n", - GetCurrentThreadId()); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_BlockUntilVerticalBlank();\n", + GetCurrentThreadId()); if(g_XBVideo.GetVSync()) g_pDD7->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, 0); @@ -5328,16 +4944,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetVerticalBlankCallback { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVerticalBlankCallback\n" - "(\n" - " pCallback : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pCallback); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVerticalBlankCallback\n" + "(\n" + " pCallback : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pCallback); g_pVBCallback = pCallback; @@ -5357,17 +4968,12 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetTextureState_TexCoordIndex { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTextureState_TexCoordIndex\n" - "(\n" - " Stage : 0x%.08X\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Stage, Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTextureState_TexCoordIndex\n" + "(\n" + " Stage : 0x%.08X\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Stage, Value); if(Value > 0x00030000) EmuCleanup("EmuIDirect3DDevice8_SetTextureState_TexCoordIndex: Unknown TexCoordIndex Value (0x%.08X)", Value); @@ -5389,16 +4995,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetTextureState_TwoSidedLighting { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTextureState_TwoSidedLighting\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTextureState_TwoSidedLighting\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); EmuWarning("TwoSidedLighting is not supported!"); @@ -5417,16 +5018,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetTextureState_BackFillMode { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTextureState_BackFillMode\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTextureState_BackFillMode\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); EmuWarning("BackFillMode is not supported!"); @@ -5446,17 +5042,12 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetTextureState_BorderColor { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTextureState_BorderColor\n" - "(\n" - " Stage : 0x%.08X\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Stage, Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTextureState_BorderColor\n" + "(\n" + " Stage : 0x%.08X\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Stage, Value); g_pD3DDevice8->SetTextureStageState(Stage, D3DTSS_BORDERCOLOR, Value); @@ -5476,17 +5067,12 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetTextureState_ColorKeyColor { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTextureState_ColorKeyColor\n" - "(\n" - " Stage : 0x%.08X\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Stage, Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTextureState_ColorKeyColor\n" + "(\n" + " Stage : 0x%.08X\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Stage, Value); EmuWarning("SetTextureState_ColorKeyColor is not supported!"); @@ -5507,18 +5093,13 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetTextureState_BumpEnv { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTextureState_BumpEnv\n" - "(\n" - " Stage : 0x%.08X\n" - " Type : 0x%.08X\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Stage, Type, Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTextureState_BumpEnv\n" + "(\n" + " Stage : 0x%.08X\n" + " Type : 0x%.08X\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Stage, Type, Value); switch(Type) { @@ -5554,16 +5135,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_FrontFace { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_FrontFace\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_FrontFace\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); EmuWarning("SetRenderState_FrontFace not supported!\n"); @@ -5582,16 +5158,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_LogicOp { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_LogicOp\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_LogicOp\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); EmuWarning("SetRenderState_LogicOp is not supported!"); @@ -5610,16 +5181,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_NormalizeNormals { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_NormalizeNormals\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_NormalizeNormals\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); g_pD3DDevice8->SetRenderState(D3DRS_NORMALIZENORMALS, Value); @@ -5638,16 +5204,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_TextureFactor { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_TextureFactor\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_TextureFactor\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); g_pD3DDevice8->SetRenderState(D3DRS_TEXTUREFACTOR, Value); @@ -5666,16 +5227,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_ZBias { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_ZBias\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_ZBias\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); g_pD3DDevice8->SetRenderState(D3DRS_ZBIAS, Value); @@ -5694,16 +5250,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_EdgeAntiAlias { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_EdgeAntiAlias\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_EdgeAntiAlias\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); // TODO: Analyze performance and compatibility (undefined behavior on PC with triangles or points) // g_pD3DDevice8->SetRenderState(D3DRS_EDGEANTIALIAS, Value); @@ -5725,16 +5276,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_FillMode { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_FillMode\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_FillMode\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); DWORD dwFillMode; @@ -5762,16 +5308,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_FogColor { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_FogColor\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_FogColor\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); g_pD3DDevice8->SetRenderState(D3DRS_FOGCOLOR, Value); @@ -5790,16 +5331,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_Dxt1NoiseEnable { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_Dxt1NoiseEnable\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_Dxt1NoiseEnable\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); EmuWarning("SetRenderState_Dxt1NoiseEnable not implemented!"); @@ -5819,17 +5355,12 @@ VOID __fastcall XTL::EmuIDirect3DDevice8_SetRenderState_Simple { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_Simple\n" - "(\n" - " Method : 0x%.08X\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Method, Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_Simple\n" + "(\n" + " Method : 0x%.08X\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Method, Value); int State = -1; @@ -5918,16 +5449,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_VertexBlend { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_VertexBlend\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_VertexBlend\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); // convert from Xbox direct3d to PC direct3d enumeration if(Value <= 1) @@ -5956,16 +5482,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_PSTextureModes { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_PSTextureModes\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_PSTextureModes\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); // TODO: do something.. @@ -5984,16 +5505,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_CullMode { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_CullMode\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_CullMode\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); // convert from Xbox D3D to PC D3D enumeration // TODO: XDK-Specific Tables? So far they are the same @@ -6029,16 +5545,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_LineWidth { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_LineWidth\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_LineWidth\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); // TODO: Convert to PC format?? // g_pD3DDevice8->SetRenderState(D3DRS_LINEPATTERN, Value); @@ -6059,16 +5570,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_StencilFail { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_StencilFail\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_StencilFail\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); g_pD3DDevice8->SetRenderState(D3DRS_STENCILFAIL, Value); @@ -6087,16 +5593,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); EmuWarning("SetRenderState_OcclusionCullEnable not supported!"); @@ -6115,16 +5616,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_StencilCullEnable { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_StencilCullEnable\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_StencilCullEnable\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); EmuWarning("SetRenderState_StencilCullEnable not supported!"); @@ -6143,16 +5639,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); EmuWarning("SetRenderState_RopZCmpAlwaysRead not supported!"); @@ -6171,16 +5662,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_RopZRead { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_RopZRead\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_RopZRead\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); EmuWarning("SetRenderState_RopZRead not supported!"); @@ -6199,16 +5685,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_DoNotCullUncompressed { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_DoNotCullUncompressed\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_DoNotCullUncompressed\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); EmuWarning("SetRenderState_DoNotCullUncompressed not supported!"); @@ -6227,16 +5708,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_ZEnable { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_ZEnable\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_ZEnable\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); g_pD3DDevice8->SetRenderState(D3DRS_ZENABLE, Value); @@ -6255,16 +5731,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_StencilEnable { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_StencilEnable\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_StencilEnable\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); g_pD3DDevice8->SetRenderState(D3DRS_STENCILENABLE, Value); @@ -6283,16 +5754,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleAntiAlias { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_MultiSampleAntiAlias\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_MultiSampleAntiAlias\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); g_pD3DDevice8->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, Value); @@ -6311,16 +5777,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleMask { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_MultiSampleMask\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_MultiSampleMask\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); g_pD3DDevice8->SetRenderState(D3DRS_MULTISAMPLEMASK, Value); @@ -6339,16 +5800,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleMode { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_MultiSampleMode\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_MultiSampleMode\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); EmuWarning("SetRenderState_MultiSampleMode is not supported!"); @@ -6367,16 +5823,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); EmuWarning("SetRenderState_MultiSampleRenderTargetMode is not supported!"); @@ -6395,16 +5846,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_ShadowFunc { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_ShadowFunc\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_ShadowFunc\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); EmuWarning("ShadowFunc not implemented"); @@ -6423,16 +5869,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_YuvEnable { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_YuvEnable\n" - "(\n" - " Value : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Value); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_YuvEnable\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); EmuWarning("YuvEnable not implemented"); @@ -6452,17 +5893,12 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetTransform { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTransform\n" - "(\n" - " State : 0x%.08X\n" - " pMatrix : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), State, pMatrix); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTransform\n" + "(\n" + " State : 0x%.08X\n" + " pMatrix : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), State, pMatrix); /* printf("pMatrix (%d)\n", State); @@ -6505,17 +5941,12 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_GetTransform { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetTransform\n" - "(\n" - " State : 0x%.08X\n" - " pMatrix : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), State, pMatrix); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetTransform\n" + "(\n" + " State : 0x%.08X\n" + " pMatrix : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), State, pMatrix); State = EmuXB2PC_D3DTS(State); @@ -6540,20 +5971,15 @@ VOID WINAPI XTL::EmuIDirect3DVertexBuffer8_Lock { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DVertexBuffer8_Lock\n" - "(\n" - " ppVertexBuffer : 0x%.08X\n" - " OffsetToLock : 0x%.08X\n" - " SizeToLock : 0x%.08X\n" - " ppbData : 0x%.08X\n" - " Flags : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ppVertexBuffer, OffsetToLock, SizeToLock, ppbData, Flags); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DVertexBuffer8_Lock\n" + "(\n" + " ppVertexBuffer : 0x%.08X\n" + " OffsetToLock : 0x%.08X\n" + " SizeToLock : 0x%.08X\n" + " ppbData : 0x%.08X\n" + " Flags : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), ppVertexBuffer, OffsetToLock, SizeToLock, ppbData, Flags); IDirect3DVertexBuffer8 *pVertexBuffer8 = ppVertexBuffer->EmuVertexBuffer8; @@ -6578,17 +6004,12 @@ BYTE* WINAPI XTL::EmuIDirect3DVertexBuffer8_Lock2 { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DVertexBuffer8_Lock2\n" - "(\n" - " ppVertexBuffer : 0x%.08X\n" - " Flags : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ppVertexBuffer, Flags); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DVertexBuffer8_Lock2\n" + "(\n" + " ppVertexBuffer : 0x%.08X\n" + " Flags : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), ppVertexBuffer, Flags); IDirect3DVertexBuffer8 *pVertexBuffer8 = ppVertexBuffer->EmuVertexBuffer8; @@ -6613,18 +6034,13 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetStreamSource { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetStreamSource\n" - "(\n" - " StreamNumber : 0x%.08X\n" - " pStreamData : 0x%.08X (0x%.08X)\n" - " Stride : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), StreamNumber, pStreamData, (pStreamData != 0) ? pStreamData->EmuVertexBuffer8 : 0, Stride); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetStreamSource\n" + "(\n" + " StreamNumber : 0x%.08X\n" + " pStreamData : 0x%.08X (0x%.08X)\n" + " Stride : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), StreamNumber, pStreamData, (pStreamData != 0) ? pStreamData->EmuVertexBuffer8 : 0, Stride); if(StreamNumber == 0) g_pVertexBuffer = pStreamData; @@ -6659,16 +6075,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetVertexShader { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexShader\n" - "(\n" - " Handle : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Handle); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexShader\n" + "(\n" + " Handle : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Handle); HRESULT hRet = D3D_OK; @@ -6715,18 +6126,13 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_DrawVertices { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_DrawVertices\n" - "(\n" - " PrimitiveType : 0x%.08X\n" - " StartVertex : 0x%.08X\n" - " VertexCount : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), PrimitiveType, StartVertex, VertexCount); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_DrawVertices\n" + "(\n" + " PrimitiveType : 0x%.08X\n" + " StartVertex : 0x%.08X\n" + " VertexCount : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), PrimitiveType, StartVertex, VertexCount); EmuUpdateDeferredStates(); @@ -6772,20 +6178,15 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_DrawVerticesUP { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_DrawVerticesUP\n" - "(\n" - " PrimitiveType : 0x%.08X\n" - " VertexCount : 0x%.08X\n" - " pVertexStreamZeroData : 0x%.08X\n" - " VertexStreamZeroStride : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), PrimitiveType, VertexCount, pVertexStreamZeroData, - VertexStreamZeroStride); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_DrawVerticesUP\n" + "(\n" + " PrimitiveType : 0x%.08X\n" + " VertexCount : 0x%.08X\n" + " pVertexStreamZeroData : 0x%.08X\n" + " VertexStreamZeroStride : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), PrimitiveType, VertexCount, pVertexStreamZeroData, + VertexStreamZeroStride); EmuUpdateDeferredStates(); @@ -6837,18 +6238,13 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_DrawIndexedVertices { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_DrawIndexedVertices\n" - "(\n" - " PrimitiveType : 0x%.08X\n" - " VertexCount : 0x%.08X\n" - " pIndexData : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), PrimitiveType, VertexCount, pIndexData); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_DrawIndexedVertices\n" + "(\n" + " PrimitiveType : 0x%.08X\n" + " VertexCount : 0x%.08X\n" + " pIndexData : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), PrimitiveType, VertexCount, pIndexData); // update index buffer, if necessary if(g_pIndexBuffer != 0 && g_pIndexBuffer->Lock == X_D3DRESOURCE_LOCK_FLAG_NOSIZE) @@ -6925,21 +6321,15 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_DrawIndexedVerticesUP { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_DrawIndexedVerticesUP\n" - "(\n" - " PrimitiveType : 0x%.08X\n" - " VertexCount : 0x%.08X\n" - " pIndexData : 0x%.08X\n" - " pVertexStreamZeroData : 0x%.08X\n" - " VertexStreamZeroStride : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), PrimitiveType, VertexCount, pIndexData, pVertexStreamZeroData, VertexStreamZeroStride); - } - - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_DrawIndexedVerticesUP\n" + "(\n" + " PrimitiveType : 0x%.08X\n" + " VertexCount : 0x%.08X\n" + " pIndexData : 0x%.08X\n" + " pVertexStreamZeroData : 0x%.08X\n" + " VertexStreamZeroStride : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), PrimitiveType, VertexCount, pIndexData, pVertexStreamZeroData, VertexStreamZeroStride); // update index buffer, if necessary if(g_pIndexBuffer != 0 && g_pIndexBuffer->Lock == X_D3DRESOURCE_LOCK_FLAG_NOSIZE) @@ -6991,17 +6381,12 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetLight { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetLight\n" - "(\n" - " Index : 0x%.08X\n" - " pLight : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Index, pLight); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetLight\n" + "(\n" + " Index : 0x%.08X\n" + " pLight : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Index, pLight); HRESULT hRet = g_pD3DDevice8->SetLight(Index, pLight); @@ -7020,16 +6405,11 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetMaterial { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetMaterial\n" - "(\n" - " pMaterial : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pMaterial); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetMaterial\n" + "(\n" + " pMaterial : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pMaterial); HRESULT hRet = g_pD3DDevice8->SetMaterial(pMaterial); @@ -7049,17 +6429,12 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_LightEnable { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_LightEnable\n" - "(\n" - " Index : 0x%.08X\n" - " bEnable : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Index, bEnable); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_LightEnable\n" + "(\n" + " Index : 0x%.08X\n" + " bEnable : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Index, bEnable); HRESULT hRet = g_pD3DDevice8->LightEnable(Index, bEnable); @@ -7075,12 +6450,7 @@ VOID WINAPI EmuIDirect3DDevice8_BlockUntilVerticalBlank() { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_BlockUntilVerticalBlank();\n", GetCurrentThreadId()); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_BlockUntilVerticalBlank();\n", GetCurrentThreadId()); return; } @@ -7096,18 +6466,13 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetRenderTarget { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderTarget\n" - "(\n" - " pRenderTarget : 0x%.08X (0x%.08X)\n" - " pNewZStencil : 0x%.08X (0x%.08X)\n" - ");\n", - GetCurrentThreadId(), pRenderTarget, (pRenderTarget != 0) ? pRenderTarget->EmuSurface8 : 0, pNewZStencil, - (pNewZStencil != 0) ? pNewZStencil->EmuSurface8 : 0); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderTarget\n" + "(\n" + " pRenderTarget : 0x%.08X (0x%.08X)\n" + " pNewZStencil : 0x%.08X (0x%.08X)\n" + ");\n", + GetCurrentThreadId(), pRenderTarget, (pRenderTarget != 0) ? pRenderTarget->EmuSurface8 : 0, pNewZStencil, + (pNewZStencil != 0) ? pNewZStencil->EmuSurface8 : 0); IDirect3DSurface8 *pPCRenderTarget = 0; IDirect3DSurface8 *pPCNewZStencil = 0; @@ -7147,17 +6512,12 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreatePalette { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreatePalette\n" - "(\n" - " Size : 0x%.08X\n" - " ppPalette : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Size, ppPalette); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreatePalette\n" + "(\n" + " Size : 0x%.08X\n" + " ppPalette : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Size, ppPalette); *ppPalette = new X_D3DPalette(); @@ -7189,17 +6549,12 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetPalette { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetPalette\n" - "(\n" - " Stage : 0x%.08X\n" - " pPalette : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Stage, pPalette); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetPalette\n" + "(\n" + " Stage : 0x%.08X\n" + " pPalette : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Stage, pPalette); // g_pD3DDevice8->SetPaletteEntries(0, (PALETTEENTRY*)pPalette->Data); @@ -7220,16 +6575,11 @@ void WINAPI XTL::EmuIDirect3DDevice8_SetFlickerFilter { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetFlickerFilter\n" - "(\n" - " Filter : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Filter); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetFlickerFilter\n" + "(\n" + " Filter : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Filter); EmuWarning("Not setting flicker filter"); @@ -7248,16 +6598,11 @@ void WINAPI XTL::EmuIDirect3DDevice8_SetSoftDisplayFilter { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetSoftDisplayFilter\n" - "(\n" - " Enable : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Enable); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetSoftDisplayFilter\n" + "(\n" + " Enable : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Enable); EmuWarning("Not setting soft display filter"); @@ -7278,18 +6623,13 @@ HRESULT WINAPI XTL::EmuIDirect3DPalette8_Lock { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuD3D8 (0x%X): EmuIDirect3DPalette8_Lock\n" - "(\n" - " pThis : 0x%.08X\n" - " ppColors : 0x%.08X\n" - " Flags : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ppColors, Flags); - } - #endif + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DPalette8_Lock\n" + "(\n" + " pThis : 0x%.08X\n" + " ppColors : 0x%.08X\n" + " Flags : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), ppColors, Flags); *ppColors = (D3DCOLOR*)pThis->Data; @@ -7308,8 +6648,7 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_GetVertexShaderSize ) { EmuSwapFS(); // Win2k/XP FS - #ifdef _DEBUG_TRACE - // debug trace + DbgPrintf( "EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetVertexShaderSize\n" "(\n" " Handle : 0x%.08X\n" @@ -7317,12 +6656,11 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_GetVertexShaderSize ");\n", GetCurrentThreadId(), Handle,pSize); - #endif - if(pSize && (Handle & 0x8000000)) { *pSize = ((VERTEX_SHADER *)((X_D3DVertexShader *)(Handle & 0x7FFFFFFF))->Handle)->Size; } + EmuSwapFS(); // Xbox FS } @@ -7336,16 +6674,14 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_DeleteVertexShader { EmuSwapFS(); - #ifdef _DEBUG_TRACE - // debug trace DbgPrintf( "EmuD3D8 (0x%.08X): EmuIDirect3DDevice8_DeleteVertexShader\n" "(\n" " Handle : 0x%.08X\n" ");\n", GetCurrentThreadId(), Handle); - #endif // _DEBUG_TRACE DWORD RealHandle = 0; + if(Handle & 0x8000000) { X_D3DVertexShader *pD3DVertexShader = (X_D3DVertexShader *)(Handle & 0x7FFFFFFF); @@ -7353,15 +6689,18 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_DeleteVertexShader RealHandle = pVertexShader->Handle; free(pVertexShader->pDeclaration); + if(pVertexShader->pFunction) { free(pVertexShader->pFunction); } + // TODO: Also free the dynamic streams patches! - for (DWORD i = 0; i < pVertexShader->VertexDynamicPatch.NbrStreams; i++) + for(DWORD i = 0; i < pVertexShader->VertexDynamicPatch.NbrStreams; i++) { free(pVertexShader->VertexDynamicPatch.pStreamPatches[i].pTypes); } + free(pVertexShader->VertexDynamicPatch.pStreamPatches); free(pVertexShader); free(pD3DVertexShader); @@ -7404,18 +6743,17 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_GetShaderConstantMode DWORD *pMode ) { -#ifdef _DEBUG_TRACE - EmuSwapFS(); // Win2k/XP FS - - // debug trace - DbgPrintf( "EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetShaderConstantMode\n" - "(\n" - " pMode : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pMode); - - EmuSwapFS(); // Xbox FS -#endif + #ifdef _DEBUG_TRACE + { + EmuSwapFS(); // Win2k/XP FS + DbgPrintf( "EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetShaderConstantMode\n" + "(\n" + " pMode : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pMode); + EmuSwapFS(); // Xbox FS + } + #endif if(pMode) { @@ -7629,7 +6967,7 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_GetVertexShaderType " Handle : 0x%.08X\n" " pType : 0x%.08X\n" ");\n", - GetCurrentThreadId(), Handle,pType); + GetCurrentThreadId(), Handle, pType); if(pType && VshHandleIsVertexShader(Handle)) { @@ -7658,7 +6996,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_GetVertexShaderDeclaration " pData : 0x%.08X\n" " pSizeOfData : 0x%.08X\n" ");\n", - GetCurrentThreadId(), Handle,pData,pSizeOfData); + GetCurrentThreadId(), Handle, pData, pSizeOfData); HRESULT hRet = D3DERR_INVALIDCALL; diff --git a/Source/Win32/CxbxKrnl/EmuDSound.cpp b/Source/Win32/CxbxKrnl/EmuDSound.cpp index 26888ad5c..eb7eba372 100644 --- a/Source/Win32/CxbxKrnl/EmuDSound.cpp +++ b/Source/Win32/CxbxKrnl/EmuDSound.cpp @@ -148,9 +148,7 @@ static void EmuResizeIDirectSoundBuffer8(XTL::X_CDirectSoundBuffer *pThis, DWORD if(dwBytes == pThis->EmuBufferDesc->dwBufferBytes || dwBytes == 0) return; - #ifdef _DEBUG_TRACE - printf("EmuResizeIDirectSoundBuffer8 : Resizing! (0x%.08X->0x%.08X)\n", pThis->EmuBufferDesc->dwBufferBytes, dwBytes); - #endif + DbgPrintf("EmuResizeIDirectSoundBuffer8 : Resizing! (0x%.08X->0x%.08X)\n", pThis->EmuBufferDesc->dwBufferBytes, dwBytes); DWORD dwPlayCursor, dwWriteCursor, dwStatus; @@ -226,18 +224,13 @@ HRESULT WINAPI XTL::EmuDirectSoundCreate { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuDirectSoundCreate\n" - "(\n" - " pguidDeviceId : 0x%.08X\n" - " ppDirectSound : 0x%.08X\n" - " pUnknown : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pguidDeviceId, ppDirectSound, pUnknown); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuDirectSoundCreate\n" + "(\n" + " pguidDeviceId : 0x%.08X\n" + " ppDirectSound : 0x%.08X\n" + " pUnknown : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pguidDeviceId, ppDirectSound, pUnknown); static bool initialized = false; @@ -286,16 +279,11 @@ ULONG WINAPI XTL::EmuIDirectSound8_AddRef { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSound8_AddRef\n" - "(\n" - " pThis : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_AddRef\n" + "(\n" + " pThis : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis); ULONG uRet = g_pDSound8RefCount++; @@ -314,16 +302,11 @@ ULONG WINAPI XTL::EmuIDirectSound8_Release { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSound8_Release\n" - "(\n" - " pThis : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_Release\n" + "(\n" + " pThis : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis); ULONG uRet = g_pDSound8RefCount--; @@ -351,20 +334,15 @@ HRESULT WINAPI XTL::EmuIDirectSound8_DownloadEffectsImage { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSound8_DownloadEffectsImage\n" - "(\n" - " pThis : 0x%.08X\n" - " pvImageBuffer : 0x%.08X\n" - " dwImageSize : 0x%.08X\n" - " pImageLoc : 0x%.08X\n" - " ppImageDesc : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, pvImageBuffer, dwImageSize, pImageLoc, ppImageDesc); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_DownloadEffectsImage\n" + "(\n" + " pThis : 0x%.08X\n" + " pvImageBuffer : 0x%.08X\n" + " dwImageSize : 0x%.08X\n" + " pImageLoc : 0x%.08X\n" + " ppImageDesc : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, pvImageBuffer, dwImageSize, pImageLoc, ppImageDesc); // TODO: Actually implement this @@ -380,12 +358,7 @@ VOID WINAPI XTL::EmuDirectSoundDoWork() { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuDirectSoundDoWork();\n", GetCurrentThreadId()); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuDirectSoundDoWork();\n", GetCurrentThreadId()); HackUpdateSoundBuffers(); HackUpdateSoundStreams(); @@ -412,23 +385,18 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetOrientation { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSound8_SetOrientation\n" - "(\n" - " pThis : 0x%.08X\n" - " xFront : %f\n" - " yFront : %f\n" - " zFront : %f\n" - " xTop : %f\n" - " yTop : %f\n" - " zTop : %f\n" - " dwApply : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, xFront, yFront, zFront, xTop, yTop, zTop, dwApply); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_SetOrientation\n" + "(\n" + " pThis : 0x%.08X\n" + " xFront : %f\n" + " yFront : %f\n" + " zFront : %f\n" + " xTop : %f\n" + " yTop : %f\n" + " zTop : %f\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, xFront, yFront, zFront, xTop, yTop, zTop, dwApply); // TODO: Actually implement this @@ -449,18 +417,13 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetDistanceFactor { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSound8_SetDistanceFactor\n" - "(\n" - " pThis : 0x%.08X\n" - " fDistanceFactor : %f\n" - " dwApply : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, fDistanceFactor, dwApply); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_SetDistanceFactor\n" + "(\n" + " pThis : 0x%.08X\n" + " fDistanceFactor : %f\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, fDistanceFactor, dwApply); // TODO: Actually implement this @@ -481,18 +444,13 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetRolloffFactor { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSound8_SetRolloffFactor\n" - "(\n" - " pThis : 0x%.08X\n" - " fRolloffFactor : %f\n" - " dwApply : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, fRolloffFactor, dwApply); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_SetRolloffFactor\n" + "(\n" + " pThis : 0x%.08X\n" + " fRolloffFactor : %f\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, fRolloffFactor, dwApply); // TODO: Actually implement this @@ -513,18 +471,13 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetDopplerFactor { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSound8_SetDopplerFactor\n" - "(\n" - " pThis : 0x%.08X\n" - " fDopplerFactor : %f\n" - " dwApply : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, fDopplerFactor, dwApply); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_SetDopplerFactor\n" + "(\n" + " pThis : 0x%.08X\n" + " fDopplerFactor : %f\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, fDopplerFactor, dwApply); // TODO: Actually implement this @@ -547,7 +500,7 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetI3DL2Listener #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSound8_SetI3DL2Listener\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_SetI3DL2Listener\n" "(\n" " pThis : 0x%.08X\n" " pDummy : 0x%.08X\n" @@ -577,7 +530,7 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetMixBinHeadroom #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSound8_SetMixBinHeadroom\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_SetMixBinHeadroom\n" "(\n" " pThis : 0x%.08X\n" " dwMixBinMask : 0x%.08X\n" @@ -606,7 +559,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetMixBins #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetMixBins\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetMixBins\n" "(\n" " pThis : 0x%.08X\n" " pMixBins : 0x%.08X\n" @@ -634,7 +587,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetMixBinVolumes #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetMixBinVolumes\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetMixBinVolumes\n" "(\n" " pThis : 0x%.08X\n" " pMixBins : 0x%.08X\n" @@ -665,7 +618,7 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetPosition #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSound8_SetPosition\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_SetPosition\n" "(\n" " pThis : 0x%.08X\n" " x : %f\n" @@ -699,7 +652,7 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetVelocity #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSound8_SetVelocity\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_SetVelocity\n" "(\n" " pThis : 0x%.08X\n" " x : %f\n" @@ -731,7 +684,7 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetAllParameters #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSound8_SetAllParameters\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_SetAllParameters\n" "(\n" " pThis : 0x%.08X\n" " pTodo : 0x%.08X\n" @@ -757,16 +710,11 @@ HRESULT WINAPI XTL::EmuCDirectSound_CommitDeferredSettings { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuCDirectSound_CommitDeferredSettings\n" - "(\n" - " pThis : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuCDirectSound_CommitDeferredSettings\n" + "(\n" + " pThis : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis); // TODO: Translate params, then make the PC DirectSound call @@ -786,17 +734,12 @@ HRESULT WINAPI XTL::EmuDirectSoundCreateBuffer { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuDirectSoundCreateBuffer\n" - "(\n" - " pdsbd : 0x%.08X\n" - " ppBuffer : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pdsbd, ppBuffer); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuDirectSoundCreateBuffer\n" + "(\n" + " pdsbd : 0x%.08X\n" + " ppBuffer : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pdsbd, ppBuffer); DSBUFFERDESC *pDSBufferDesc = (DSBUFFERDESC*)malloc(sizeof(DSBUFFERDESC)); @@ -866,9 +809,7 @@ HRESULT WINAPI XTL::EmuDirectSoundCreateBuffer (*ppBuffer)->EmuLockPtr2 = 0; (*ppBuffer)->EmuLockBytes2 = 0; - #ifdef _DEBUG_TRACE - printf("EmuDSound (0x%X): EmuDirectSoundCreateBuffer, *ppBuffer := 0x%.08X, bytes := 0x%.08X\n", GetCurrentThreadId(), *ppBuffer, pDSBufferDesc->dwBufferBytes); - #endif + DbgPrintf("EmuDSound (0x%X): EmuDirectSoundCreateBuffer, *ppBuffer := 0x%.08X, bytes := 0x%.08X\n", GetCurrentThreadId(), *ppBuffer, pDSBufferDesc->dwBufferBytes); HRESULT hRet = g_pDSound8->CreateSoundBuffer(pDSBufferDesc, &((*ppBuffer)->EmuDirectSoundBuffer8), NULL); @@ -911,7 +852,7 @@ HRESULT WINAPI XTL::EmuIDirectSound8_CreateBuffer #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSound8_CreateBuffer\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_CreateBuffer\n" "(\n" " pThis : 0x%.08X\n" " pdssd : 0x%.08X\n" @@ -943,7 +884,7 @@ HRESULT WINAPI XTL::EmuIDirectSound8_CreateSoundBuffer #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSound8_CreateSoundBuffer\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_CreateSoundBuffer\n" "(\n" " pdsbd : 0x%.08X\n" " ppBuffer : 0x%.08X\n" @@ -969,18 +910,13 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetBufferData { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetBufferData\n" - "(\n" - " pThis : 0x%.08X\n" - " pvBufferData : 0x%.08X\n" - " dwBufferBytes : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, pvBufferData, dwBufferBytes); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetBufferData\n" + "(\n" + " pThis : 0x%.08X\n" + " pvBufferData : 0x%.08X\n" + " dwBufferBytes : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, pvBufferData, dwBufferBytes); // update buffer data cache pThis->EmuBuffer = pvBufferData; @@ -1004,18 +940,13 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetPlayRegion { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetPlayRegion\n" - "(\n" - " pThis : 0x%.08X\n" - " dwPlayStart : 0x%.08X\n" - " dwPlayLength : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, dwPlayStart, dwPlayLength); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetPlayRegion\n" + "(\n" + " pThis : 0x%.08X\n" + " dwPlayStart : 0x%.08X\n" + " dwPlayLength : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, dwPlayStart, dwPlayLength); // TODO: Translate params, then make the PC DirectSound call @@ -1044,24 +975,19 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_Lock { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_Lock\n" - "(\n" - " pThis : 0x%.08X\n" - " dwOffset : 0x%.08X\n" - " dwBytes : 0x%.08X\n" - " ppvAudioPtr1 : 0x%.08X\n" - " pdwAudioBytes1 : 0x%.08X\n" - " ppvAudioPtr2 : 0x%.08X\n" - " pdwAudioBytes2 : 0x%.08X\n" - " dwFlags : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, dwOffset, dwBytes, ppvAudioPtr1, pdwAudioBytes1, - ppvAudioPtr2, pdwAudioBytes2, dwFlags); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_Lock\n" + "(\n" + " pThis : 0x%.08X\n" + " dwOffset : 0x%.08X\n" + " dwBytes : 0x%.08X\n" + " ppvAudioPtr1 : 0x%.08X\n" + " pdwAudioBytes1 : 0x%.08X\n" + " ppvAudioPtr2 : 0x%.08X\n" + " pdwAudioBytes2 : 0x%.08X\n" + " dwFlags : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, dwOffset, dwBytes, ppvAudioPtr1, pdwAudioBytes1, + ppvAudioPtr2, pdwAudioBytes2, dwFlags); HRESULT hRet = D3D_OK; @@ -1106,17 +1032,12 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetHeadroom { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetHeadroom\n" - "(\n" - " pThis : 0x%.08X\n" - " dwHeadroom : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, dwHeadroom); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetHeadroom\n" + "(\n" + " pThis : 0x%.08X\n" + " dwHeadroom : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, dwHeadroom); // TODO: Actually implement this @@ -1137,18 +1058,13 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetLoopRegion { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetLoopRegion\n" - "(\n" - " pThis : 0x%.08X\n" - " dwLoopStart : 0x%.08X\n" - " dwLoopLength : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, dwLoopStart, dwLoopLength); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetLoopRegion\n" + "(\n" + " pThis : 0x%.08X\n" + " dwLoopStart : 0x%.08X\n" + " dwLoopLength : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, dwLoopStart, dwLoopLength); // TODO: Ensure that 4627 & 4361 are intercepting far enough back // (otherwise pThis is manipulated!) @@ -1170,16 +1086,11 @@ ULONG WINAPI XTL::EmuIDirectSoundBuffer8_Release { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_Release\n" - "(\n" - " pThis : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_Release\n" + "(\n" + " pThis : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis); ULONG uRet = 0; @@ -1221,17 +1132,12 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetPitch { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetPitch\n" - "(\n" - " pThis : 0x%.08X\n" - " lPitch : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, lPitch); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetPitch\n" + "(\n" + " pThis : 0x%.08X\n" + " lPitch : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, lPitch); // TODO: Translate params, then make the PC DirectSound call @@ -1251,17 +1157,12 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_GetStatus { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_GetStatus\n" - "(\n" - " pThis : 0x%.08X\n" - " pdwStatus : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, pdwStatus); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_GetStatus\n" + "(\n" + " pThis : 0x%.08X\n" + " pdwStatus : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, pdwStatus); HRESULT hRet = DS_OK; @@ -1290,17 +1191,12 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetCurrentPosition { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetCurrentPosition\n" - "(\n" - " pThis : 0x%.08X\n" - " dwNewPosition : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, dwNewPosition); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetCurrentPosition\n" + "(\n" + " pThis : 0x%.08X\n" + " dwNewPosition : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, dwNewPosition); // NOTE: TODO: This call *will* (by MSDN) fail on primary buffers! HRESULT hRet = pThis->EmuDirectSoundBuffer8->SetCurrentPosition(dwNewPosition); @@ -1325,18 +1221,13 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_GetCurrentPosition { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_GetCurrentPosition\n" - "(\n" - " pThis : 0x%.08X\n" - " pdwCurrentPlayCursor : 0x%.08X\n" - " pdwCurrentWriteCursor : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, pdwCurrentPlayCursor, pdwCurrentWriteCursor); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_GetCurrentPosition\n" + "(\n" + " pThis : 0x%.08X\n" + " pdwCurrentPlayCursor : 0x%.08X\n" + " pdwCurrentWriteCursor : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, pdwCurrentPlayCursor, pdwCurrentWriteCursor); HackUpdateSoundBuffers(); HackUpdateSoundStreams(); @@ -1347,12 +1238,10 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_GetCurrentPosition if(FAILED(hRet)) EmuWarning("GetCurrentPosition Failed!"); - #ifdef _DEBUG_TRACE if(pdwCurrentPlayCursor != 0 && pdwCurrentWriteCursor != 0) { - printf("*pdwCurrentPlayCursor := %d, *pdwCurrentWriteCursor := %d\n", *pdwCurrentPlayCursor, *pdwCurrentWriteCursor); + DbgPrintf("*pdwCurrentPlayCursor := %d, *pdwCurrentWriteCursor := %d\n", *pdwCurrentPlayCursor, *pdwCurrentWriteCursor); } - #endif EmuSwapFS(); // XBox FS @@ -1372,19 +1261,14 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_Play { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_Play\n" - "(\n" - " pThis : 0x%.08X\n" - " dwReserved1 : 0x%.08X\n" - " dwReserved2 : 0x%.08X\n" - " dwFlags : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, dwReserved1, dwReserved2, dwFlags); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_Play\n" + "(\n" + " pThis : 0x%.08X\n" + " dwReserved1 : 0x%.08X\n" + " dwReserved2 : 0x%.08X\n" + " dwFlags : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, dwReserved1, dwReserved2, dwFlags); if(dwFlags & (~DSBPLAY_LOOPING)) EmuCleanup("Unsupported Playing Flags"); @@ -1424,16 +1308,11 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_Stop { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_Stop\n" - "(\n" - " pThis : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_Stop\n" + "(\n" + " pThis : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis); HRESULT hRet = pThis->EmuDirectSoundBuffer8->Stop(); @@ -1453,17 +1332,12 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetVolume { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetVolume\n" - "(\n" - " pThis : 0x%.08X\n" - " lVolume : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, lVolume); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetVolume\n" + "(\n" + " pThis : 0x%.08X\n" + " lVolume : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, lVolume); // TODO: Ensure that 4627 & 4361 are intercepting far enough back // (otherwise pThis is manipulated!) @@ -1487,17 +1361,12 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetFrequency { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetFrequency\n" - "(\n" - " pThis : 0x%.08X\n" - " dwFrequency : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, dwFrequency); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetFrequency\n" + "(\n" + " pThis : 0x%.08X\n" + " dwFrequency : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, dwFrequency); // HRESULT hRet = pThis->EmuDirectSoundBuffer8->SetFrequency(dwFrequency); @@ -1518,17 +1387,12 @@ HRESULT WINAPI XTL::EmuDirectSoundCreateStream { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuDirectSoundCreateStream\n" - "(\n" - " pdssd : 0x%.08X\n" - " ppStream : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pdssd, ppStream); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuDirectSoundCreateStream\n" + "(\n" + " pdssd : 0x%.08X\n" + " ppStream : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pdssd, ppStream); // TODO: Garbage Collection *ppStream = new X_CDirectSoundStream(); @@ -1584,9 +1448,7 @@ HRESULT WINAPI XTL::EmuDirectSoundCreateStream (*ppStream)->EmuLockPtr2 = 0; (*ppStream)->EmuLockBytes2 = 0; - #ifdef _DEBUG_TRACE - printf("EmuDSound (0x%X): EmuDirectSoundCreateStream, *ppStream := 0x%.08X\n", GetCurrentThreadId(), *ppStream); - #endif + DbgPrintf("EmuDSound (0x%X): EmuDirectSoundCreateStream, *ppStream := 0x%.08X\n", GetCurrentThreadId(), *ppStream); HRESULT hRet = g_pDSound8->CreateSoundBuffer(pDSBufferDesc, &(*ppStream)->EmuDirectSoundBuffer8, NULL); @@ -1629,7 +1491,7 @@ HRESULT WINAPI XTL::EmuIDirectSound8_CreateStream #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSound8_CreateStream\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_CreateStream\n" "(\n" " pThis : 0x%.08X\n" " pdssd : 0x%.08X\n" @@ -1653,17 +1515,12 @@ ULONG WINAPI XTL::EmuCDirectSoundStream_SetVolume(X_CDirectSoundStream *pThis, L { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuCDirectSoundStream_SetVolume\n" - "(\n" - " pThis : 0x%.08X\n" - " lVolume : %d\n" - ");\n", - GetCurrentThreadId(), pThis, lVolume); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_SetVolume\n" + "(\n" + " pThis : 0x%.08X\n" + " lVolume : %d\n" + ");\n", + GetCurrentThreadId(), pThis, lVolume); // TODO: Actually SetVolume @@ -1684,18 +1541,13 @@ HRESULT WINAPI XTL::EmuCDirectSoundStream_SetRolloffFactor { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuCDirectSoundStream_SetRolloffFactor\n" - "(\n" - " pThis : 0x%.08X\n" - " fRolloffFactor : %f\n" - " dwApply : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, fRolloffFactor, dwApply); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_SetRolloffFactor\n" + "(\n" + " pThis : 0x%.08X\n" + " fRolloffFactor : %f\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, fRolloffFactor, dwApply); // TODO: Actually SetRolloffFactor @@ -1711,16 +1563,11 @@ ULONG WINAPI XTL::EmuCDirectSoundStream_AddRef(X_CDirectSoundStream *pThis) { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuCDirectSoundStream_AddRef\n" - "(\n" - " pThis : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_AddRef\n" + "(\n" + " pThis : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis); if(pThis != 0) pThis->EmuDirectSoundBuffer8->AddRef(); @@ -1737,16 +1584,11 @@ ULONG WINAPI XTL::EmuCDirectSoundStream_Release(X_CDirectSoundStream *pThis) { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuCDirectSoundStream_Release\n" - "(\n" - " pThis : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_Release\n" + "(\n" + " pThis : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis); ULONG uRet = 0; @@ -1789,18 +1631,13 @@ HRESULT WINAPI XTL::EmuCDirectSoundStream_Process { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuCDirectSoundStream_Process\n" - "(\n" - " pThis : 0x%.08X\n" - " pInputBuffer : 0x%.08X\n" - " pOutputBuffer : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, pInputBuffer, pOutputBuffer); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_Process\n" + "(\n" + " pThis : 0x%.08X\n" + " pInputBuffer : 0x%.08X\n" + " pOutputBuffer : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, pInputBuffer, pOutputBuffer); // update buffer data cache pThis->EmuBuffer = pInputBuffer->pvBuffer; @@ -1823,16 +1660,11 @@ HRESULT WINAPI XTL::EmuCDirectSoundStream_Discontinuity(X_CDirectSoundStream *pT { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuCDirectSoundStream_Discontinuity\n" - "(\n" - " pThis : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_Discontinuity\n" + "(\n" + " pThis : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis); // TODO: Actually Process @@ -1852,17 +1684,12 @@ HRESULT WINAPI XTL::EmuCDirectSoundStream_Pause { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuCDirectSoundStream_Pause\n" - "(\n" - " pStream : 0x%.08X\n" - " dwPause : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pStream, dwPause); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_Pause\n" + "(\n" + " pStream : 0x%.08X\n" + " dwPause : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pStream, dwPause); EmuSwapFS(); // XBox FS @@ -1880,17 +1707,12 @@ HRESULT WINAPI XTL::EmuIDirectSoundStream_SetHeadroom { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSoundStream_SetHeadroom\n" - "(\n" - " pThis : 0x%.08X\n" - " dwHeadroom : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, dwHeadroom); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundStream_SetHeadroom\n" + "(\n" + " pThis : 0x%.08X\n" + " dwHeadroom : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, dwHeadroom); // TODO: Actually implement this @@ -1912,19 +1734,14 @@ HRESULT WINAPI XTL::EmuCDirectSoundStream_SetConeAngles { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuCDirectSoundStream_SetConeAngles\n" - "(\n" - " pThis : 0x%.08X\n" - " dwInsideConeAngle : 0x%.08X\n" - " dwOutsideConeAngle : 0x%.08X\n" - " dwApply : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, dwInsideConeAngle, dwOutsideConeAngle, dwApply); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_SetConeAngles\n" + "(\n" + " pThis : 0x%.08X\n" + " dwInsideConeAngle : 0x%.08X\n" + " dwOutsideConeAngle : 0x%.08X\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, dwInsideConeAngle, dwOutsideConeAngle, dwApply); // TODO: Actually implement this @@ -1945,18 +1762,13 @@ HRESULT WINAPI XTL::EmuCDirectSoundStream_SetConeOutsideVolume { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuCDirectSoundStream_SetConeOutsideVolume\n" - "(\n" - " pThis : 0x%.08X\n" - " lConeOutsideVolume : %d\n" - " dwApply : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, lConeOutsideVolume, dwApply); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_SetConeOutsideVolume\n" + "(\n" + " pThis : 0x%.08X\n" + " lConeOutsideVolume : %d\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, lConeOutsideVolume, dwApply); // TODO: Actually implement this @@ -1977,18 +1789,13 @@ HRESULT WINAPI XTL::EmuCDirectSoundStream_SetAllParameters { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuCDirectSoundStream_SetAllParameters\n" - "(\n" - " pThis : 0x%.08X\n" - " pUnknown : %f\n" - " dwApply : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, pUnknown, dwApply); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_SetAllParameters\n" + "(\n" + " pThis : 0x%.08X\n" + " pUnknown : %f\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, pUnknown, dwApply); // TODO: Actually implement this @@ -2009,18 +1816,13 @@ HRESULT WINAPI XTL::EmuCDirectSoundStream_SetMaxDistance { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuCDirectSoundStream_SetMaxDistance\n" - "(\n" - " pThis : 0x%.08X\n" - " fMaxDistance : %f\n" - " dwApply : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, fMaxDistance, dwApply); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_SetMaxDistance\n" + "(\n" + " pThis : 0x%.08X\n" + " fMaxDistance : %f\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, fMaxDistance, dwApply); // TODO: Actually implement this @@ -2041,18 +1843,13 @@ HRESULT WINAPI XTL::EmuCDirectSoundStream_SetMinDistance { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuCDirectSoundStream_SetMinDistance\n" - "(\n" - " pThis : 0x%.08X\n" - " fMinDistance : %f\n" - " dwApply : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, fMinDistance, dwApply); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_SetMinDistance\n" + "(\n" + " pThis : 0x%.08X\n" + " fMinDistance : %f\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, fMinDistance, dwApply); // TODO: Actually implement this @@ -2075,20 +1872,15 @@ HRESULT WINAPI XTL::EmuCDirectSoundStream_SetVelocity { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuCDirectSoundStream_SetVelocity\n" - "(\n" - " pThis : 0x%.08X\n" - " x : %f\n" - " y : %f\n" - " z : %f\n" - " dwApply : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, x, y, z, dwApply); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_SetVelocity\n" + "(\n" + " pThis : 0x%.08X\n" + " x : %f\n" + " y : %f\n" + " z : %f\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, x, y, z, dwApply); // TODO: Actually implement this @@ -2111,20 +1903,15 @@ HRESULT WINAPI XTL::EmuCDirectSoundStream_SetConeOrientation { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuCDirectSoundStream_SetConeOrientation\n" - "(\n" - " pThis : 0x%.08X\n" - " x : %f\n" - " y : %f\n" - " z : %f\n" - " dwApply : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, x, y, z, dwApply); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_SetConeOrientation\n" + "(\n" + " pThis : 0x%.08X\n" + " x : %f\n" + " y : %f\n" + " z : %f\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, x, y, z, dwApply); // TODO: Actually implement this @@ -2147,20 +1934,15 @@ HRESULT WINAPI XTL::EmuCDirectSoundStream_SetPosition { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuCDirectSoundStream_SetPosition\n" - "(\n" - " pThis : 0x%.08X\n" - " x : %f\n" - " y : %f\n" - " z : %f\n" - " dwApply : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, x, y, z, dwApply); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_SetPosition\n" + "(\n" + " pThis : 0x%.08X\n" + " x : %f\n" + " y : %f\n" + " z : %f\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, x, y, z, dwApply); // TODO: Actually implement this @@ -2180,17 +1962,12 @@ HRESULT WINAPI XTL::EmuCDirectSoundStream_SetFrequency { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuCDirectSoundStream_SetFrequency\n" - "(\n" - " pThis : 0x%.08X\n" - " dwFrequency : %d\n" - ");\n", - GetCurrentThreadId(), pThis, dwFrequency); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_SetFrequency\n" + "(\n" + " pThis : 0x%.08X\n" + " dwFrequency : %d\n" + ");\n", + GetCurrentThreadId(), pThis, dwFrequency); // TODO: Actually implement this @@ -2211,18 +1988,13 @@ HRESULT WINAPI XTL::EmuIDirectSoundStream_SetI3DL2Source { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSoundStream_SetI3DL2Source\n" - "(\n" - " pThis : 0x%.08X\n" - " pds3db : 0x%.08X\n" - " dwApply : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, pds3db, dwApply); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundStream_SetI3DL2Source\n" + "(\n" + " pThis : 0x%.08X\n" + " pds3db : 0x%.08X\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, pds3db, dwApply); // TODO: Actually implement this @@ -2242,17 +2014,12 @@ HRESULT WINAPI XTL::EmuIDirectSoundStream_Unknown1 { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSoundStream_Unknown1\n" - "(\n" - " pThis : 0x%.08X\n" - " dwUnknown1 : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, dwUnknown1); - } - #endif + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundStream_Unknown1\n" + "(\n" + " pThis : 0x%.08X\n" + " dwUnknown1 : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, dwUnknown1); // TODO: Actually implement this @@ -2276,7 +2043,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetMaxDistance #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetMaxDistance\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetMaxDistance\n" "(\n" " pThis : 0x%.08X\n" " flMaxDistance : %f\n" @@ -2306,7 +2073,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetMinDistance #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetMinDistance\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetMinDistance\n" "(\n" " pThis : 0x%.08X\n" " flMinDistance : %f\n" @@ -2336,7 +2103,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetRolloffFactor #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetRolloffFactor\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetRolloffFactor\n" "(\n" " pThis : 0x%.08X\n" " flRolloffFactor : %f\n" @@ -2366,7 +2133,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetDistanceFactor #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetDistanceFactor\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetDistanceFactor\n" "(\n" " pThis : 0x%.08X\n" " flDistanceFactor : %f\n" @@ -2397,7 +2164,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetConeAngles #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetConeAngles\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetConeAngles\n" "(\n" " pThis : 0x%.08X\n" " dwInsideConeAngle : 0x%.08X\n" @@ -2431,7 +2198,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetConeOrientation #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetConeOrientation\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetConeOrientation\n" "(\n" " pThis : 0x%.08X\n" " x : %f\n" @@ -2463,7 +2230,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetConeOutsideVolume #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetConeOutsideVolume\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetConeOutsideVolume\n" "(\n" " pThis : 0x%.08X\n" " lConeOutsideVolume : 0x%.08X\n" @@ -2495,7 +2262,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetPosition #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetPosition\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetPosition\n" "(\n" " pThis : 0x%.08X\n" " x : %f\n" @@ -2529,7 +2296,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetVelocity #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetVelocity\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetVelocity\n" "(\n" " pThis : 0x%.08X\n" " x : %f\n" @@ -2561,7 +2328,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetDopplerFactor #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetConeOutsideVolume\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetConeOutsideVolume\n" "(\n" " pThis : 0x%.08X\n" " flDopplerFactor : %f\n" @@ -2591,7 +2358,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetI3DL2Source #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetI3DL2Source\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetI3DL2Source\n" "(\n" " pThis : 0x%.08X\n" " pds3db : 0x%.08X\n" diff --git a/Source/Win32/CxbxKrnl/EmuFS.cpp b/Source/Win32/CxbxKrnl/EmuFS.cpp index 3cd33bd18..86b900267 100644 --- a/Source/Win32/CxbxKrnl/EmuFS.cpp +++ b/Source/Win32/CxbxKrnl/EmuFS.cpp @@ -82,12 +82,12 @@ void EmuGenerateFS(Xbe::TLS *pTLS, void *pTLSData) #ifdef _DEBUG_TRACE if(pNewTLS == 0) { - printf("EmuFS (0x%X): TLS Non-Existant (OK)\n", GetCurrentThreadId()); + DbgPrintf("EmuFS (0x%X): TLS Non-Existant (OK)\n", GetCurrentThreadId()); } else { - printf("EmuFS (0x%X): TLS Data Dump...\n", GetCurrentThreadId()); - printf("EmuFS (0x%X): 0x%.08X: ", GetCurrentThreadId(), pNewTLS); + DbgPrintf("EmuFS (0x%X): TLS Data Dump...\n", GetCurrentThreadId()); + DbgPrintf("EmuFS (0x%X): 0x%.08X: ", GetCurrentThreadId(), pNewTLS); uint32 stop = pTLS->dwDataEndAddr - pTLS->dwDataStartAddr + pTLS->dwSizeofZeroFill; @@ -95,13 +95,13 @@ void EmuGenerateFS(Xbe::TLS *pTLS, void *pTLSData) { uint08 *bByte = (uint08*)pNewTLS + v; - printf("%.01X", (uint32)*bByte); + DbgPrintf("%.01X", (uint32)*bByte); if((v+1) % 0x10 == 0 && v+1ObjectName->Buffer, - IoStatusBlock, AllocationSize, FileAttributes, ShareAccess, Disposition, CreateOptions, Options); - } - #endif + DbgPrintf("EmuKrnl (0x%X): IoCreateFile\n" + "(\n" + " FileHandle : 0x%.08X\n" + " DesiredAccess : 0x%.08X\n" + " ObjectAttributes : 0x%.08X (%s)\n" + " IoStatusBlock : 0x%.08X\n" + " AllocationSize : 0x%.08X\n" + " FileAttributes : 0x%.08X\n" + " ShareAccess : 0x%.08X\n" + " Disposition : 0x%.08X\n" + " CreateOptions : 0x%.08X\n" + " Options : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), FileHandle, DesiredAccess, ObjectAttributes, ObjectAttributes->ObjectName->Buffer, + IoStatusBlock, AllocationSize, FileAttributes, ShareAccess, Disposition, CreateOptions, Options); NTSTATUS ret = STATUS_SUCCESS; @@ -440,18 +410,13 @@ XBSYSAPI EXPORTNUM(67) NTSTATUS NTAPI xboxkrnl::IoCreateSymbolicLink { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): IoCreateSymbolicLink\n" - "(\n" - " SymbolicLinkName : 0x%.08X (%s)\n" - " DeviceName : 0x%.08X (%s)\n" - ");\n", - GetCurrentThreadId(), SymbolicLinkName, SymbolicLinkName->Buffer, - DeviceName, DeviceName->Buffer); - } - #endif + DbgPrintf("EmuKrnl (0x%X): IoCreateSymbolicLink\n" + "(\n" + " SymbolicLinkName : 0x%.08X (%s)\n" + " DeviceName : 0x%.08X (%s)\n" + ");\n", + GetCurrentThreadId(), SymbolicLinkName, SymbolicLinkName->Buffer, + DeviceName, DeviceName->Buffer); // TODO: Actually um...implement this function NTSTATUS ret = STATUS_OBJECT_NAME_COLLISION; @@ -471,16 +436,11 @@ XBSYSAPI EXPORTNUM(69) NTSTATUS NTAPI xboxkrnl::IoDeleteSymbolicLink { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): IoDeleteSymbolicLink\n" - "(\n" - " SymbolicLinkName : 0x%.08X (%s)\n" - ");\n", - GetCurrentThreadId(), SymbolicLinkName, SymbolicLinkName->Buffer); - } - #endif + DbgPrintf("EmuKrnl (0x%X): IoDeleteSymbolicLink\n" + "(\n" + " SymbolicLinkName : 0x%.08X (%s)\n" + ");\n", + GetCurrentThreadId(), SymbolicLinkName, SymbolicLinkName->Buffer); // TODO: Actually um...implement this function NTSTATUS ret = STATUS_OBJECT_NAME_NOT_FOUND; @@ -502,18 +462,13 @@ XBSYSAPI EXPORTNUM(99) NTSTATUS NTAPI xboxkrnl::KeDelayExecutionThread { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): KeDelayExecutionThread\n" - "(\n" - " WaitMode : 0x%.08X\n" - " Alertable : 0x%.08X\n" - " Interval : 0x%.08X (%d)\n" - ");\n", - GetCurrentThreadId(), WaitMode, Alertable, Interval, Interval == 0 ? 0 : Interval->QuadPart); - } - #endif + DbgPrintf("EmuKrnl (0x%X): KeDelayExecutionThread\n" + "(\n" + " WaitMode : 0x%.08X\n" + " Alertable : 0x%.08X\n" + " Interval : 0x%.08X (%d)\n" + ");\n", + GetCurrentThreadId(), WaitMode, Alertable, Interval, Interval == 0 ? 0 : Interval->QuadPart); NTSTATUS ret = NtDll::NtDelayExecution(Alertable, (NtDll::LARGE_INTEGER*)Interval); @@ -534,18 +489,13 @@ XBSYSAPI EXPORTNUM(107) VOID NTAPI xboxkrnl::KeInitializeDpc { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): KeInitializeDpc\n" - "(\n" - " Dpc : 0x%.08X\n" - " DeferredRoutine : 0x%.08X\n" - " DeferredContext : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Dpc, DeferredRoutine, DeferredContext); - } - #endif + DbgPrintf("EmuKrnl (0x%X): KeInitializeDpc\n" + "(\n" + " Dpc : 0x%.08X\n" + " DeferredRoutine : 0x%.08X\n" + " DeferredContext : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Dpc, DeferredRoutine, DeferredContext); // inialize Dpc field values Dpc->Number = 0; @@ -569,17 +519,12 @@ XBSYSAPI EXPORTNUM(113) VOID NTAPI xboxkrnl::KeInitializeTimerEx { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): KeInitializeTimerEx\n" - "(\n" - " Timer : 0x%.08X\n" - " Type : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Timer, Type); - } - #endif + DbgPrintf("EmuKrnl (0x%X): KeInitializeTimerEx\n" + "(\n" + " Timer : 0x%.08X\n" + " Type : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Timer, Type); Timer->Header.Type = Type + 8; Timer->Header.Inserted = 0; @@ -604,12 +549,7 @@ XBSYSAPI EXPORTNUM(126) xboxkrnl::ULONGLONG NTAPI xboxkrnl::KeQueryPerformanceCo { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): KeQueryPerformanceCounter();\n", GetCurrentThreadId()); - } - #endif + DbgPrintf("EmuKrnl (0x%X): KeQueryPerformanceCounter();\n", GetCurrentThreadId()); ::LARGE_INTEGER Counter; @@ -627,12 +567,7 @@ XBSYSAPI EXPORTNUM(127) xboxkrnl::ULONGLONG NTAPI xboxkrnl::KeQueryPerformanceFr { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): KeQueryPerformanceFrequency();\n", GetCurrentThreadId()); - } - #endif + DbgPrintf("EmuKrnl (0x%X): KeQueryPerformanceFrequency();\n", GetCurrentThreadId()); // Xbox Performance Counter Frequency := 337F98h ::LARGE_INTEGER Frequency; @@ -654,16 +589,11 @@ XBSYSAPI EXPORTNUM(128) VOID NTAPI xboxkrnl::KeQuerySystemTime { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): KeQuerySystemTime\n" - "(\n" - " CurrentTime : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), CurrentTime); - } - #endif + DbgPrintf("EmuKrnl (0x%X): KeQuerySystemTime\n" + "(\n" + " CurrentTime : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), CurrentTime); // TODO: optimize for WinXP if speed ever becomes important here @@ -690,18 +620,13 @@ XBSYSAPI EXPORTNUM(149) xboxkrnl::BOOLEAN NTAPI xboxkrnl::KeSetTimer { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): KeSetTimer\n" - "(\n" - " Timer : 0x%.08X\n" - " DueTime : 0x%I64X\n" - " Dpc : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Timer, DueTime, Dpc); - } - #endif + DbgPrintf("EmuKrnl (0x%X): KeSetTimer\n" + "(\n" + " Timer : 0x%.08X\n" + " DueTime : 0x%I64X\n" + " Dpc : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Timer, DueTime, Dpc); EmuCleanup("KeSetTimer is not implemented"); @@ -743,16 +668,11 @@ XBSYSAPI EXPORTNUM(165) xboxkrnl::PVOID NTAPI xboxkrnl::MmAllocateContiguousMemo { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): MmAllocateContiguousMemory\n" - "(\n" - " NumberOfBytes : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), NumberOfBytes); - } - #endif + DbgPrintf("EmuKrnl (0x%X): MmAllocateContiguousMemory\n" + "(\n" + " NumberOfBytes : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), NumberOfBytes); DWORD dwAlignIndex = -1; @@ -791,9 +711,7 @@ XBSYSAPI EXPORTNUM(165) xboxkrnl::PVOID NTAPI xboxkrnl::MmAllocateContiguousMemo g_pAlignCache[dwAlignIndex].pAligPtr = pRet; } - #ifdef _DEBUG_TRACE - printf("EmuKrnl (0x%X): MmAllocateContiguous returned 0x%.08X\n", GetCurrentThreadId(), pRet); - #endif + DbgPrintf("EmuKrnl (0x%X): MmAllocateContiguous returned 0x%.08X\n", GetCurrentThreadId(), pRet); EmuSwapFS(); // Xbox FS @@ -814,21 +732,16 @@ XBSYSAPI EXPORTNUM(166) xboxkrnl::PVOID NTAPI xboxkrnl::MmAllocateContiguousMemo { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): MmAllocateContiguousMemoryEx\n" - "(\n" - " NumberOfBytes : 0x%.08X\n" - " LowestAcceptableAddress : 0x%.08X\n" - " HighestAcceptableAddress : 0x%.08X\n" - " Alignment : 0x%.08X\n" - " ProtectionType : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), NumberOfBytes, LowestAcceptableAddress, HighestAcceptableAddress, - Alignment, ProtectionType); - } - #endif + DbgPrintf("EmuKrnl (0x%X): MmAllocateContiguousMemoryEx\n" + "(\n" + " NumberOfBytes : 0x%.08X\n" + " LowestAcceptableAddress : 0x%.08X\n" + " HighestAcceptableAddress : 0x%.08X\n" + " Alignment : 0x%.08X\n" + " ProtectionType : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), NumberOfBytes, LowestAcceptableAddress, HighestAcceptableAddress, + Alignment, ProtectionType); DWORD dwAlignIndex = -1; @@ -872,9 +785,7 @@ XBSYSAPI EXPORTNUM(166) xboxkrnl::PVOID NTAPI xboxkrnl::MmAllocateContiguousMemo if(count++ < 4) g_HaloHack[count-1] = (uint32)pRet; - #ifdef _DEBUG_TRACE - printf("EmuKrnl (0x%X): MmAllocateContiguousEx returned 0x%.08X\n", GetCurrentThreadId(), pRet); - #endif + DbgPrintf("EmuKrnl (0x%X): MmAllocateContiguousEx returned 0x%.08X\n", GetCurrentThreadId(), pRet); EmuSwapFS(); // Xbox FS @@ -892,19 +803,12 @@ XBSYSAPI EXPORTNUM(167) xboxkrnl::PVOID NTAPI xboxkrnl::MmAllocateSystemMemory { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): MmAllocateContiguousMemoryEx\n" - "(\n" - " NumberOfBytes : 0x%.08X\n" - " Protect : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), NumberOfBytes, Protect); - } - #endif + DbgPrintf("EmuKrnl (0x%X): MmAllocateContiguousMemoryEx\n" + "(\n" + " NumberOfBytes : 0x%.08X\n" + " Protect : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), NumberOfBytes, Protect); // TODO: should this be aligned? PVOID pRet = malloc(NumberOfBytes); @@ -924,16 +828,11 @@ XBSYSAPI EXPORTNUM(171) VOID NTAPI xboxkrnl::MmFreeContiguousMemory { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): MmFreeContiguousMemory\n" - "(\n" - " BaseAddress : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BaseAddress); - } - #endif + DbgPrintf("EmuKrnl (0x%X): MmFreeContiguousMemory\n" + "(\n" + " BaseAddress : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), BaseAddress); // retrieve correct allocation base address (since MmAllocContiguousMemory[Ex] aligns upward) { @@ -969,17 +868,12 @@ XBSYSAPI EXPORTNUM(172) NTSTATUS NTAPI xboxkrnl::MmFreeSystemMemory { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): MmFreeSystemMemory\n" - "(\n" - " BaseAddress : 0x%.08X\n" - " NumberOfBytes : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BaseAddress, NumberOfBytes); - } - #endif + DbgPrintf("EmuKrnl (0x%X): MmFreeSystemMemory\n" + "(\n" + " BaseAddress : 0x%.08X\n" + " NumberOfBytes : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), BaseAddress, NumberOfBytes); free(BaseAddress); @@ -1000,18 +894,13 @@ XBSYSAPI EXPORTNUM(178) VOID NTAPI xboxkrnl::MmPersistContiguousMemory { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): MmPersistContiguousMemory\n" - "(\n" - " BaseAddress : 0x%.08X\n" - " NumberOfBytes : 0x%.08X\n" - " Persist : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BaseAddress, NumberOfBytes, Persist); - } - #endif + DbgPrintf("EmuKrnl (0x%X): MmPersistContiguousMemory\n" + "(\n" + " BaseAddress : 0x%.08X\n" + " NumberOfBytes : 0x%.08X\n" + " Persist : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), BaseAddress, NumberOfBytes, Persist); // TODO: Actually set this up to be remember across a "reboot" EmuWarning("MmPersistContiguousMemory is being ignored\n"); @@ -1029,16 +918,11 @@ XBSYSAPI EXPORTNUM(181) NTSTATUS NTAPI xboxkrnl::MmQueryStatistics { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): MmQueryStatistics\n" - "(\n" - " MemoryStatistics : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), MemoryStatistics); - } - #endif + DbgPrintf("EmuKrnl (0x%X): MmQueryStatistics\n" + "(\n" + " MemoryStatistics : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), MemoryStatistics); MEMORYSTATUS MemoryStatus; @@ -1072,27 +956,20 @@ XBSYSAPI EXPORTNUM(182) VOID NTAPI xboxkrnl::MmSetAddressProtect { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): MmSetAddressProtect\n" - "(\n" - " BaseAddress : 0x%.08X\n" - " NumberOfBytes : 0x%.08X\n" - " NewProtect : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BaseAddress, NumberOfBytes, NewProtect); - } - #endif + DbgPrintf("EmuKrnl (0x%X): MmSetAddressProtect\n" + "(\n" + " BaseAddress : 0x%.08X\n" + " NumberOfBytes : 0x%.08X\n" + " NewProtect : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), BaseAddress, NumberOfBytes, NewProtect); // Halo Hack if(BaseAddress == (PVOID)0x80366000) { BaseAddress = (PVOID)(g_HaloHack[0] + (0x80366000 - 0x80061000)); - #ifdef _DEBUG_TRACE - printf("EmuKrnl (0x%X): Halo Access Adjust 3 was applied! (0x%.08X)\n", GetCurrentThreadId(), BaseAddress); - #endif + DbgPrintf("EmuKrnl (0x%X): Halo Access Adjust 3 was applied! (0x%.08X)\n", GetCurrentThreadId(), BaseAddress); } DWORD dwOldProtect; @@ -1100,9 +977,7 @@ XBSYSAPI EXPORTNUM(182) VOID NTAPI xboxkrnl::MmSetAddressProtect if(!VirtualProtect(BaseAddress, NumberOfBytes, NewProtect & (~PAGE_WRITECOMBINE), &dwOldProtect)) EmuWarning("VirtualProtect Failed!"); - #ifdef _DEBUG_TRACE - printf("EmuKrnl (0x%X): VirtualProtect was 0x%.08X -> 0x%.08X\n", GetCurrentThreadId(), dwOldProtect, NewProtect & (~PAGE_WRITECOMBINE)); - #endif + DbgPrintf("EmuKrnl (0x%X): VirtualProtect was 0x%.08X -> 0x%.08X\n", GetCurrentThreadId(), dwOldProtect, NewProtect & (~PAGE_WRITECOMBINE)); EmuSwapFS(); // Xbox FS @@ -1123,20 +998,15 @@ XBSYSAPI EXPORTNUM(184) NTSTATUS NTAPI xboxkrnl::NtAllocateVirtualMemory { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtAllocateVirtualMemory\n" - "(\n" - " BaseAddress : 0x%.08X (0x%.08X)\n" - " ZeroBits : 0x%.08X\n" - " AllocationSize : 0x%.08X (0x%.08X)\n" - " AllocationType : 0x%.08X\n" - " Protect : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BaseAddress, *BaseAddress, ZeroBits, AllocationSize, *AllocationSize, AllocationType, Protect); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtAllocateVirtualMemory\n" + "(\n" + " BaseAddress : 0x%.08X (0x%.08X)\n" + " ZeroBits : 0x%.08X\n" + " AllocationSize : 0x%.08X (0x%.08X)\n" + " AllocationType : 0x%.08X\n" + " Protect : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), BaseAddress, *BaseAddress, ZeroBits, AllocationSize, *AllocationSize, AllocationType, Protect); NTSTATUS ret = NtDll::NtAllocateVirtualMemory(GetCurrentProcess(), BaseAddress, ZeroBits, AllocationSize, AllocationType, Protect); @@ -1155,16 +1025,11 @@ XBSYSAPI EXPORTNUM(186) NTSTATUS NTAPI xboxkrnl::NtClearEvent { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtClearEvent\n" - "(\n" - " EventHandle : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), EventHandle); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtClearEvent\n" + "(\n" + " EventHandle : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), EventHandle); NTSTATUS ret = NtDll::NtClearEvent(EventHandle); @@ -1186,16 +1051,11 @@ XBSYSAPI EXPORTNUM(187) NTSTATUS NTAPI xboxkrnl::NtClose { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtClose\n" - "(\n" - " Handle : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Handle); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtClose\n" + "(\n" + " Handle : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Handle); NTSTATUS ret = STATUS_SUCCESS; @@ -1234,20 +1094,15 @@ XBSYSAPI EXPORTNUM(189) NTSTATUS NTAPI xboxkrnl::NtCreateEvent char *szBuffer = (ObjectAttributes != 0) ? ObjectAttributes->ObjectName->Buffer : 0; - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtCreateEvent\n" - "(\n" - " EventHandle : 0x%.08X\n" - " ObjectAttributes : 0x%.08X (\"%s\")\n" - " EventType : 0x%.08X\n" - " InitialState : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), EventHandle, ObjectAttributes, szBuffer, - EventType, InitialState); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtCreateEvent\n" + "(\n" + " EventHandle : 0x%.08X\n" + " ObjectAttributes : 0x%.08X (\"%s\")\n" + " EventType : 0x%.08X\n" + " InitialState : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), EventHandle, ObjectAttributes, szBuffer, + EventType, InitialState); wchar_t wszObjectName[160]; @@ -1273,9 +1128,7 @@ XBSYSAPI EXPORTNUM(189) NTSTATUS NTAPI xboxkrnl::NtCreateEvent if(FAILED(ret)) EmuWarning("NtCreateEvent Failed!"); - #ifdef _DEBUG_TRACE - printf("EmuKrnl (0x%X): NtCreateEvent EventHandle = 0x%.08X\n", GetCurrentThreadId(), *EventHandle); - #endif + DbgPrintf("EmuKrnl (0x%X): NtCreateEvent EventHandle = 0x%.08X\n", GetCurrentThreadId(), *EventHandle); EmuSwapFS(); // Xbox FS @@ -1300,25 +1153,20 @@ XBSYSAPI EXPORTNUM(190) NTSTATUS NTAPI xboxkrnl::NtCreateFile { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtCreateFile\n" - "(\n" - " FileHandle : 0x%.08X\n" - " DesiredAccess : 0x%.08X\n" - " ObjectAttributes : 0x%.08X (\"%s\")\n" - " IoStatusBlock : 0x%.08X\n" - " AllocationSize : 0x%.08X\n" - " FileAttributes : 0x%.08X\n" - " ShareAccess : 0x%.08X\n" - " CreateDisposition : 0x%.08X\n" - " CreateOptions : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), FileHandle, DesiredAccess, ObjectAttributes, ObjectAttributes->ObjectName->Buffer, - IoStatusBlock, AllocationSize, FileAttributes, ShareAccess, CreateDisposition, CreateOptions); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtCreateFile\n" + "(\n" + " FileHandle : 0x%.08X\n" + " DesiredAccess : 0x%.08X\n" + " ObjectAttributes : 0x%.08X (\"%s\")\n" + " IoStatusBlock : 0x%.08X\n" + " AllocationSize : 0x%.08X\n" + " FileAttributes : 0x%.08X\n" + " ShareAccess : 0x%.08X\n" + " CreateDisposition : 0x%.08X\n" + " CreateOptions : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), FileHandle, DesiredAccess, ObjectAttributes, ObjectAttributes->ObjectName->Buffer, + IoStatusBlock, AllocationSize, FileAttributes, ShareAccess, CreateDisposition, CreateOptions); char ReplaceChar = '\0'; int ReplaceIndex = -1; @@ -1332,11 +1180,9 @@ XBSYSAPI EXPORTNUM(190) NTSTATUS NTAPI xboxkrnl::NtCreateFile ObjectAttributes->RootDirectory = g_hCurDir; - #ifdef _DEBUG_TRACE - printf("EmuKrnl (0x%X): NtCreateFile Corrected path...\n", GetCurrentThreadId()); - printf(" Org:\"%s\"\n", ObjectAttributes->ObjectName->Buffer); - printf(" New:\"$XbePath\\%s\"\n", szBuffer); - #endif + DbgPrintf("EmuKrnl (0x%X): NtCreateFile Corrected path...\n", GetCurrentThreadId()); + DbgPrintf(" Org:\"%s\"\n", ObjectAttributes->ObjectName->Buffer); + DbgPrintf(" New:\"$XbePath\\%s\"\n", szBuffer); } else if( (szBuffer[0] == 'T' || szBuffer[0] == 't') && szBuffer[1] == ':' && szBuffer[2] == '\\') { @@ -1344,11 +1190,9 @@ XBSYSAPI EXPORTNUM(190) NTSTATUS NTAPI xboxkrnl::NtCreateFile ObjectAttributes->RootDirectory = g_hTDrive; - #ifdef _DEBUG_TRACE - printf("EmuKrnl (0x%X): NtCreateFile Corrected path...\n", GetCurrentThreadId()); - printf(" Org:\"%s\"\n", ObjectAttributes->ObjectName->Buffer); - printf(" New:\"$CxbxPath\\TDATA\\%s\"\n", szBuffer); - #endif + DbgPrintf("EmuKrnl (0x%X): NtCreateFile Corrected path...\n", GetCurrentThreadId()); + DbgPrintf(" Org:\"%s\"\n", ObjectAttributes->ObjectName->Buffer); + DbgPrintf(" New:\"$CxbxPath\\TDATA\\%s\"\n", szBuffer); } else if( (szBuffer[0] == 'U' || szBuffer[0] == 'u') && szBuffer[1] == ':' && szBuffer[2] == '\\') { @@ -1356,11 +1200,9 @@ XBSYSAPI EXPORTNUM(190) NTSTATUS NTAPI xboxkrnl::NtCreateFile ObjectAttributes->RootDirectory = g_hUDrive; - #ifdef _DEBUG_TRACE - printf("EmuKrnl (0x%X): NtCreateFile Corrected path...\n", GetCurrentThreadId()); - printf(" Org:\"%s\"\n", ObjectAttributes->ObjectName->Buffer); - printf(" New:\"$CxbxPath\\UDATA\\%s\"\n", szBuffer); - #endif + DbgPrintf("EmuKrnl (0x%X): NtCreateFile Corrected path...\n", GetCurrentThreadId()); + DbgPrintf(" Org:\"%s\"\n", ObjectAttributes->ObjectName->Buffer); + DbgPrintf(" New:\"$CxbxPath\\UDATA\\%s\"\n", szBuffer); } else if( (szBuffer[0] == 'Z' || szBuffer[0] == 'z') && szBuffer[1] == ':' && szBuffer[2] == '\\') { @@ -1368,11 +1210,9 @@ XBSYSAPI EXPORTNUM(190) NTSTATUS NTAPI xboxkrnl::NtCreateFile ObjectAttributes->RootDirectory = g_hZDrive; - #ifdef _DEBUG_TRACE - printf("EmuKrnl (0x%X): NtCreateFile Corrected path...\n", GetCurrentThreadId()); - printf(" Org:\"%s\"\n", ObjectAttributes->ObjectName->Buffer); - printf(" New:\"$CxbxPath\\CxbxCache\\%s\"\n", szBuffer); - #endif + DbgPrintf("EmuKrnl (0x%X): NtCreateFile Corrected path...\n", GetCurrentThreadId()); + DbgPrintf(" Org:\"%s\"\n", ObjectAttributes->ObjectName->Buffer); + DbgPrintf(" New:\"$CxbxPath\\CxbxCache\\%s\"\n", szBuffer); } // TODO: Wildcards are not allowed?? @@ -1417,12 +1257,10 @@ XBSYSAPI EXPORTNUM(190) NTSTATUS NTAPI xboxkrnl::NtCreateFile (NtDll::LARGE_INTEGER*)AllocationSize, FileAttributes, ShareAccess, CreateDisposition, CreateOptions, NULL, NULL ); - #ifdef _DEBUG_TRACE if(FAILED(ret)) - printf("EmuKrnl (0x%X): NtCreateFile Failed! (0x%.08X)\n", GetCurrentThreadId(), ret); + DbgPrintf("EmuKrnl (0x%X): NtCreateFile Failed! (0x%.08X)\n", GetCurrentThreadId(), ret); else - printf("EmuKrnl (0x%X): NtCreateFile = 0x%.08X\n", GetCurrentThreadId(), *FileHandle); - #endif + DbgPrintf("EmuKrnl (0x%X): NtCreateFile = 0x%.08X\n", GetCurrentThreadId(), *FileHandle); // restore original buffer if(ReplaceIndex != -1) @@ -1450,18 +1288,13 @@ XBSYSAPI EXPORTNUM(192) NTSTATUS NTAPI xboxkrnl::NtCreateMutant char *szBuffer = (ObjectAttributes != 0) ? ObjectAttributes->ObjectName->Buffer : 0; - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtCreateMutant\n" - "(\n" - " MutantHandle : 0x%.08X\n" - " ObjectAttributes : 0x%.08X (\"%s\")\n" - " InitialOwner : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), MutantHandle, ObjectAttributes, szBuffer, InitialOwner); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtCreateMutant\n" + "(\n" + " MutantHandle : 0x%.08X\n" + " ObjectAttributes : 0x%.08X (\"%s\")\n" + " InitialOwner : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), MutantHandle, ObjectAttributes, szBuffer, InitialOwner); wchar_t wszObjectName[160]; @@ -1487,9 +1320,7 @@ XBSYSAPI EXPORTNUM(192) NTSTATUS NTAPI xboxkrnl::NtCreateMutant if(FAILED(ret)) EmuWarning("NtCreateMutant Failed!"); - #ifdef _DEBUG_TRACE - printf("EmuKrnl (0x%X): NtCreateMutant MutantHandle = 0x%.08X\n", GetCurrentThreadId(), *MutantHandle); - #endif + DbgPrintf("EmuKrnl (0x%X): NtCreateMutant MutantHandle = 0x%.08X\n", GetCurrentThreadId(), *MutantHandle); EmuSwapFS(); // Xbox FS @@ -1508,18 +1339,13 @@ XBSYSAPI EXPORTNUM(197) NTSTATUS NTAPI xboxkrnl::NtDuplicateObject { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtDuplicateObject\n" - "(\n" - " SourceHandle : 0x%.08X\n" - " TargetHandle : 0x%.08X\n" - " Options : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), SourceHandle, TargetHandle, Options); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtDuplicateObject\n" + "(\n" + " SourceHandle : 0x%.08X\n" + " TargetHandle : 0x%.08X\n" + " Options : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), SourceHandle, TargetHandle, Options); // redirect to Win2k/XP NTSTATUS ret = NtDll::NtDuplicateObject @@ -1551,18 +1377,13 @@ XBSYSAPI EXPORTNUM(199) NTSTATUS NTAPI xboxkrnl::NtFreeVirtualMemory { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtFreeVirtualMemory\n" - "(\n" - " BaseAddress : 0x%.08X\n" - " FreeSize : 0x%.08X\n" - " FreeType : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BaseAddress, FreeSize, FreeType); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtFreeVirtualMemory\n" + "(\n" + " BaseAddress : 0x%.08X\n" + " FreeSize : 0x%.08X\n" + " FreeType : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), BaseAddress, FreeSize, FreeType); NTSTATUS ret = NtDll::NtFreeVirtualMemory(GetCurrentProcess(), BaseAddress, FreeSize, FreeType); @@ -1589,7 +1410,7 @@ XBSYSAPI EXPORTNUM(202) NTSTATUS NTAPI xboxkrnl::NtOpenFile #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuKrnl (0x%X): NtOpenFile\n" + DbgPrintf("EmuKrnl (0x%X): NtOpenFile\n" "(\n" " FileHandle : 0x%.08X\n" " DesiredAccess : 0x%.08X\n" @@ -1627,27 +1448,22 @@ XBSYSAPI EXPORTNUM(207) NTSTATUS NTAPI xboxkrnl::NtQueryDirectoryFile { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtQueryDirectoryFile\n" - "(\n" - " FileHandle : 0x%.08X\n" - " Event : 0x%.08X\n" - " ApcRoutine : 0x%.08X\n" - " ApcContext : 0x%.08X\n" - " IoStatusBlock : 0x%.08X\n" - " FileInformation : 0x%.08X\n" - " Length : 0x%.08X\n" - " FileInformationClass : 0x%.08X\n" - " FileMask : 0x%.08X (%s)\n" - " RestartScan : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, - FileInformation, Length, FileInformationClass, FileMask, - (FileMask != 0) ? FileMask->Buffer : "", RestartScan); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtQueryDirectoryFile\n" + "(\n" + " FileHandle : 0x%.08X\n" + " Event : 0x%.08X\n" + " ApcRoutine : 0x%.08X\n" + " ApcContext : 0x%.08X\n" + " IoStatusBlock : 0x%.08X\n" + " FileInformation : 0x%.08X\n" + " Length : 0x%.08X\n" + " FileInformationClass : 0x%.08X\n" + " FileMask : 0x%.08X (%s)\n" + " RestartScan : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, + FileInformation, Length, FileInformationClass, FileMask, + (FileMask != 0) ? FileMask->Buffer : "", RestartScan); NTSTATUS ret; @@ -1713,17 +1529,12 @@ XBSYSAPI EXPORTNUM(210) NTSTATUS NTAPI xboxkrnl::NtQueryFullAttributesFile { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtQueryFullAttributesFile\n" - "(\n" - " ObjectAttributes : 0x%.08X (%s)\n" - " Attributes : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ObjectAttributes, ObjectAttributes->ObjectName->Buffer, Attributes); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtQueryFullAttributesFile\n" + "(\n" + " ObjectAttributes : 0x%.08X (%s)\n" + " Attributes : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), ObjectAttributes, ObjectAttributes->ObjectName->Buffer, Attributes); char *szBuffer = ObjectAttributes->ObjectName->Buffer; @@ -1762,21 +1573,16 @@ XBSYSAPI EXPORTNUM(211) NTSTATUS NTAPI xboxkrnl::NtQueryInformationFile { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtQueryInformationFile\n" - "(\n" - " FileHandle : 0x%.08X\n" - " IoStatusBlock : 0x%.08X\n" - " FileInformation : 0x%.08X\n" - " Length : 0x%.08X\n" - " FileInformationClass: 0x%.08X\n" - ");\n", - GetCurrentThreadId(), FileHandle, IoStatusBlock, FileInformation, - Length, FileInfo); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtQueryInformationFile\n" + "(\n" + " FileHandle : 0x%.08X\n" + " IoStatusBlock : 0x%.08X\n" + " FileInformation : 0x%.08X\n" + " Length : 0x%.08X\n" + " FileInformationClass: 0x%.08X\n" + ");\n", + GetCurrentThreadId(), FileHandle, IoStatusBlock, FileInformation, + Length, FileInfo); if(FileInfo != FilePositionInformation && FileInfo != FileNetworkOpenInformation) EmuCleanup("Unknown FILE_INFORMATION_CLASS 0x%.08X", FileInfo); @@ -1809,21 +1615,16 @@ XBSYSAPI EXPORTNUM(218) NTSTATUS NTAPI xboxkrnl::NtQueryVolumeInformationFile { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtQueryVolumeInformationFile\n" - "(\n" - " FileHandle : 0x%.08X\n" - " IoStatusBlock : 0x%.08X\n" - " FileInformation : 0x%.08X\n" - " Length : 0x%.08X\n" - " FileInformationClass: 0x%.08X\n" - ");\n", - GetCurrentThreadId(), FileHandle, IoStatusBlock, FileInformation, - Length, FileInformationClass); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtQueryVolumeInformationFile\n" + "(\n" + " FileHandle : 0x%.08X\n" + " IoStatusBlock : 0x%.08X\n" + " FileInformation : 0x%.08X\n" + " Length : 0x%.08X\n" + " FileInformationClass: 0x%.08X\n" + ");\n", + GetCurrentThreadId(), FileHandle, IoStatusBlock, FileInformation, + Length, FileInformationClass); // Safety/Sanity Check if(FileInformationClass != FileFsSizeInformation && FileInformationClass != FileDirectoryInformation) @@ -1870,24 +1671,19 @@ XBSYSAPI EXPORTNUM(219) NTSTATUS NTAPI xboxkrnl::NtReadFile { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtReadFile\n" - "(\n" - " FileHandle : 0x%.08X\n" - " Event : 0x%.08X\n" - " ApcRoutine : 0x%.08X\n" - " ApcContext : 0x%.08X\n" - " IoStatusBlock : 0x%.08X\n" - " Buffer : 0x%.08X\n" - " Length : 0x%.08X\n" - " ByteOffset : 0x%.08X (0x%.08X)\n" - ");\n", - GetCurrentThreadId(), FileHandle, Event, ApcRoutine, - ApcContext, IoStatusBlock, Buffer, Length, ByteOffset, ByteOffset == 0 ? 0 : ByteOffset->QuadPart); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtReadFile\n" + "(\n" + " FileHandle : 0x%.08X\n" + " Event : 0x%.08X\n" + " ApcRoutine : 0x%.08X\n" + " ApcContext : 0x%.08X\n" + " IoStatusBlock : 0x%.08X\n" + " Buffer : 0x%.08X\n" + " Length : 0x%.08X\n" + " ByteOffset : 0x%.08X (0x%.08X)\n" + ");\n", + GetCurrentThreadId(), FileHandle, Event, ApcRoutine, + ApcContext, IoStatusBlock, Buffer, Length, ByteOffset, ByteOffset == 0 ? 0 : ByteOffset->QuadPart); // Halo... // if(ByteOffset != 0 && ByteOffset->QuadPart == 0x00120800) @@ -1914,17 +1710,12 @@ XBSYSAPI EXPORTNUM(221) NTSTATUS NTAPI xboxkrnl::NtReleaseMutant { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtReleaseMutant\n" - "(\n" - " MutantHandle : 0x%.08X\n" - " PreviousCount : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), MutantHandle, PreviousCount); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtReleaseMutant\n" + "(\n" + " MutantHandle : 0x%.08X\n" + " PreviousCount : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), MutantHandle, PreviousCount); // redirect to NtCreateMutant NTSTATUS ret = NtDll::NtReleaseMutant(MutantHandle, PreviousCount); @@ -1948,17 +1739,12 @@ XBSYSAPI EXPORTNUM(224) NTSTATUS NTAPI xboxkrnl::NtResumeThread { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtResumeThread\n" - "(\n" - " ThreadHandle : 0x%.08X\n" - " PreviousSuspendCount : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ThreadHandle, PreviousSuspendCount); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtResumeThread\n" + "(\n" + " ThreadHandle : 0x%.08X\n" + " PreviousSuspendCount : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), ThreadHandle, PreviousSuspendCount); NTSTATUS ret = NtDll::NtResumeThread(ThreadHandle, PreviousSuspendCount); @@ -1980,17 +1766,12 @@ XBSYSAPI EXPORTNUM(225) NTSTATUS NTAPI xboxkrnl::NtSetEvent { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtSetEvent\n" - "(\n" - " EventHandle : 0x%.08X\n" - " PreviousState : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), EventHandle, PreviousState); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtSetEvent\n" + "(\n" + " EventHandle : 0x%.08X\n" + " PreviousState : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), EventHandle, PreviousState); NTSTATUS ret = NtDll::NtSetEvent(EventHandle, PreviousState); @@ -2016,21 +1797,16 @@ XBSYSAPI EXPORTNUM(226) NTSTATUS NTAPI xboxkrnl::NtSetInformationFile { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtSetInformationFile\n" - "(\n" - " FileHandle : 0x%.08X\n" - " IoStatusBlock : 0x%.08X\n" - " FileInformation : 0x%.08X\n" - " Length : 0x%.08X\n" - " FileInformationClass : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), FileHandle, IoStatusBlock, FileInformation, - Length, FileInformationClass); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtSetInformationFile\n" + "(\n" + " FileHandle : 0x%.08X\n" + " IoStatusBlock : 0x%.08X\n" + " FileInformation : 0x%.08X\n" + " Length : 0x%.08X\n" + " FileInformationClass : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), FileHandle, IoStatusBlock, FileInformation, + Length, FileInformationClass); NTSTATUS ret = NtDll::NtSetInformationFile(FileHandle, IoStatusBlock, FileInformation, Length, FileInformationClass); @@ -2050,17 +1826,12 @@ XBSYSAPI EXPORTNUM(231) NTSTATUS NTAPI xboxkrnl::NtSuspendThread { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtSuspendThread\n" - "(\n" - " ThreadHandle : 0x%.08X\n" - " PreviousSuspendCount : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ThreadHandle, PreviousSuspendCount); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtSuspendThread\n" + "(\n" + " ThreadHandle : 0x%.08X\n" + " PreviousSuspendCount : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), ThreadHandle, PreviousSuspendCount); NTSTATUS ret = NtDll::NtSuspendThread(ThreadHandle, PreviousSuspendCount); @@ -2081,18 +1852,13 @@ XBSYSAPI EXPORTNUM(232) VOID NTAPI xboxkrnl::NtUserIoApcDispatcher { // Note: This function is called within Win2k/XP context, so no EmuSwapFS here - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtUserIoApcDispatcher\n" - "(\n" - " ApcContext : 0x%.08X\n" - " IoStatusBlock : 0x%.08X\n" - " Reserved : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ApcContext, IoStatusBlock, Reserved); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtUserIoApcDispatcher\n" + "(\n" + " ApcContext : 0x%.08X\n" + " IoStatusBlock : 0x%.08X\n" + " Reserved : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), ApcContext, IoStatusBlock, Reserved); EmuSwapFS(); // Xbox FS @@ -2158,9 +1924,7 @@ XBSYSAPI EXPORTNUM(232) VOID NTAPI xboxkrnl::NtUserIoApcDispatcher EmuSwapFS(); // Win2k/XP FS - #ifdef _DEBUG_TRACE - printf("EmuKrnl (0x%X): NtUserIoApcDispatcher Completed\n", GetCurrentThreadId()); - #endif + DbgPrintf("EmuKrnl (0x%X): NtUserIoApcDispatcher Completed\n", GetCurrentThreadId()); return; } @@ -2178,19 +1942,14 @@ XBSYSAPI EXPORTNUM(234) NTSTATUS NTAPI xboxkrnl::NtWaitForSingleObjectEx { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtWaitForSingleObjectEx\n" - "(\n" - " Handle : 0x%.08X\n" - " WaitMode : 0x%.08X\n" - " Alertable : 0x%.08X\n" - " Timeout : 0x%.08X (%d)\n" - ");\n", - GetCurrentThreadId(), Handle, WaitMode, Alertable, Timeout, Timeout == 0 ? 0 : Timeout->QuadPart); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtWaitForSingleObjectEx\n" + "(\n" + " Handle : 0x%.08X\n" + " WaitMode : 0x%.08X\n" + " Alertable : 0x%.08X\n" + " Timeout : 0x%.08X (%d)\n" + ");\n", + GetCurrentThreadId(), Handle, WaitMode, Alertable, Timeout, Timeout == 0 ? 0 : Timeout->QuadPart); NTSTATUS ret = NtDll::NtWaitForSingleObject(Handle, Alertable, (NtDll::PLARGE_INTEGER)Timeout); @@ -2214,22 +1973,17 @@ XBSYSAPI EXPORTNUM(235) NTSTATUS NTAPI xboxkrnl::NtWaitForMultipleObjectsEx { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtWaitForMultipleObjectsEx\n" - "(\n" - " Count : 0x%.08X\n" - " Handles : 0x%.08X\n" - " WaitType : 0x%.08X\n" - " WaitMode : 0x%.08X\n" - " Alertable : 0x%.08X\n" - " Timeout : 0x%.08X (%d)\n" - ");\n", - GetCurrentThreadId(), Count, Handles, WaitType, WaitMode, Alertable, - Timeout, Timeout == 0 ? 0 : Timeout->QuadPart); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtWaitForMultipleObjectsEx\n" + "(\n" + " Count : 0x%.08X\n" + " Handles : 0x%.08X\n" + " WaitType : 0x%.08X\n" + " WaitMode : 0x%.08X\n" + " Alertable : 0x%.08X\n" + " Timeout : 0x%.08X (%d)\n" + ");\n", + GetCurrentThreadId(), Count, Handles, WaitType, WaitMode, Alertable, + Timeout, Timeout == 0 ? 0 : Timeout->QuadPart); NTSTATUS ret = NtDll::NtWaitForMultipleObjects(Count, Handles, (NtDll::OBJECT_WAIT_TYPE)WaitType, Alertable, (NtDll::PLARGE_INTEGER)Timeout); @@ -2255,24 +2009,19 @@ XBSYSAPI EXPORTNUM(236) NTSTATUS NTAPI xboxkrnl::NtWriteFile { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): NtWriteFile\n" - "(\n" - " FileHandle : 0x%.08X\n" - " Event : 0x%.08X\n" - " ApcRoutine : 0x%.08X\n" - " ApcContext : 0x%.08X\n" - " IoStatusBlock : 0x%.08X\n" - " Buffer : 0x%.08X\n" - " Length : 0x%.08X\n" - " ByteOffset : 0x%.08X (0x%.08X)\n" - ");\n", - GetCurrentThreadId(), FileHandle, Event, ApcRoutine, - ApcContext, IoStatusBlock, Buffer, Length, ByteOffset, ByteOffset == 0 ? 0 : ByteOffset->QuadPart); - } - #endif + DbgPrintf("EmuKrnl (0x%X): NtWriteFile\n" + "(\n" + " FileHandle : 0x%.08X\n" + " Event : 0x%.08X\n" + " ApcRoutine : 0x%.08X\n" + " ApcContext : 0x%.08X\n" + " IoStatusBlock : 0x%.08X\n" + " Buffer : 0x%.08X\n" + " Length : 0x%.08X\n" + " ByteOffset : 0x%.08X (0x%.08X)\n" + ");\n", + GetCurrentThreadId(), FileHandle, Event, ApcRoutine, + ApcContext, IoStatusBlock, Buffer, Length, ByteOffset, ByteOffset == 0 ? 0 : ByteOffset->QuadPart); // Halo.. // if(ByteOffset != 0 && ByteOffset->QuadPart == 0x01C00800) @@ -2295,13 +2044,8 @@ XBSYSAPI EXPORTNUM(238) VOID NTAPI xboxkrnl::NtYieldExecution() { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - // NOTE: this eats up the debug log far too quickly - //printf("EmuKrnl (0x%X): NtYieldExecution();\n", GetCurrentThreadId()); - } - #endif + // NOTE: this eats up the debug log far too quickly + //DbgPrintf("EmuKrnl (0x%X): NtYieldExecution();\n", GetCurrentThreadId()); NtDll::NtYieldExecution(); @@ -2329,26 +2073,21 @@ XBSYSAPI EXPORTNUM(255) NTSTATUS NTAPI xboxkrnl::PsCreateSystemThreadEx { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): PsCreateSystemThreadEx\n" - "(\n" - " ThreadHandle : 0x%.08X\n" - " ThreadExtraSize : 0x%.08X\n" - " KernelStackSize : 0x%.08X\n" - " TlsDataSize : 0x%.08X\n" - " ThreadId : 0x%.08X\n" - " StartContext1 : 0x%.08X\n" - " StartContext2 : 0x%.08X\n" - " CreateSuspended : 0x%.08X\n" - " DebugStack : 0x%.08X\n" - " StartRoutine : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ThreadHandle, ThreadExtraSize, KernelStackSize, TlsDataSize, ThreadId, - StartContext1, StartContext2, CreateSuspended, DebugStack, StartRoutine); - } - #endif + DbgPrintf("EmuKrnl (0x%X): PsCreateSystemThreadEx\n" + "(\n" + " ThreadHandle : 0x%.08X\n" + " ThreadExtraSize : 0x%.08X\n" + " KernelStackSize : 0x%.08X\n" + " TlsDataSize : 0x%.08X\n" + " ThreadId : 0x%.08X\n" + " StartContext1 : 0x%.08X\n" + " StartContext2 : 0x%.08X\n" + " CreateSuspended : 0x%.08X\n" + " DebugStack : 0x%.08X\n" + " StartRoutine : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), ThreadHandle, ThreadExtraSize, KernelStackSize, TlsDataSize, ThreadId, + StartContext1, StartContext2, CreateSuspended, DebugStack, StartRoutine); // create thread, using our special proxy technique { @@ -2365,9 +2104,7 @@ XBSYSAPI EXPORTNUM(255) NTSTATUS NTAPI xboxkrnl::PsCreateSystemThreadEx *ThreadHandle = (HANDLE)_beginthreadex(NULL, NULL, PCSTProxy, iPCSTProxyParam, NULL, (uint*)&dwThreadId); // *ThreadHandle = CreateThread(NULL, NULL, PCSTProxy, iPCSTProxyParam, NULL, &dwThreadId); - #ifdef _DEBUG_TRACE - printf("EmuKrnl (0x%X): ThreadHandle : 0x%X, ThreadId : 0x%.08X\n", GetCurrentThreadId(), *ThreadHandle, dwThreadId); - #endif + DbgPrintf("EmuKrnl (0x%X): ThreadHandle : 0x%X, ThreadId : 0x%.08X\n", GetCurrentThreadId(), *ThreadHandle, dwThreadId); // we must duplicate this handle in order to retain Suspend/Resume thread rights from a remote thread { @@ -2394,16 +2131,11 @@ XBSYSAPI EXPORTNUM(258) VOID NTAPI xboxkrnl::PsTerminateSystemThread(IN NTSTATUS { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): PsTerminateSystemThread\n" - "(\n" - " ExitStatus : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ExitStatus); - } - #endif + DbgPrintf("EmuKrnl (0x%X): PsTerminateSystemThread\n" + "(\n" + " ExitStatus : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), ExitStatus); // call thread notification routine(s) if(g_pfnThreadNotification != 0) @@ -2439,18 +2171,13 @@ XBSYSAPI EXPORTNUM(260) NTSTATUS NTAPI xboxkrnl::RtlAnsiStringToUnicodeString { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): RtlAnsiStringToUnicodeString\n" - "(\n" - " DestinationString : 0x%.08X\n" - " SourceString : 0x%.08X\n" - " AllocateDestinationString : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), DestinationString, SourceString, AllocateDestinationString); - } - #endif + DbgPrintf("EmuKrnl (0x%X): RtlAnsiStringToUnicodeString\n" + "(\n" + " DestinationString : 0x%.08X\n" + " SourceString : 0x%.08X\n" + " AllocateDestinationString : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), DestinationString, SourceString, AllocateDestinationString); NTSTATUS ret = NtDll::RtlAnsiStringToUnicodeString((NtDll::UNICODE_STRING*)DestinationString, (NtDll::STRING*)SourceString, AllocateDestinationString); @@ -2469,18 +2196,13 @@ XBSYSAPI EXPORTNUM(277) VOID NTAPI xboxkrnl::RtlEnterCriticalSection { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - /** sorta pointless - printf("EmuKrnl (0x%X): RtlEnterCriticalSection\n" - "(\n" - " CriticalSection : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), CriticalSection); - //*/ - } - #endif + /** sorta pointless + DbgPrintf("EmuKrnl (0x%X): RtlEnterCriticalSection\n" + "(\n" + " CriticalSection : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), CriticalSection); + //*/ //printf("CriticalSection->LockCount : %d\n", CriticalSection->LockCount); @@ -2506,17 +2228,12 @@ XBSYSAPI EXPORTNUM(289) VOID NTAPI xboxkrnl::RtlInitAnsiString { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): RtlInitAnsiString\n" - "(\n" - " DestinationString : 0x%.08X\n" - " SourceString : 0x%.08X (\"%s\")\n" - ");\n", - GetCurrentThreadId(), DestinationString, SourceString, SourceString); - } - #endif + DbgPrintf("EmuKrnl (0x%X): RtlInitAnsiString\n" + "(\n" + " DestinationString : 0x%.08X\n" + " SourceString : 0x%.08X (\"%s\")\n" + ");\n", + GetCurrentThreadId(), DestinationString, SourceString, SourceString); NtDll::RtlInitAnsiString((NtDll::PANSI_STRING)DestinationString, (NtDll::PCSZ)SourceString); @@ -2535,18 +2252,13 @@ XBSYSAPI EXPORTNUM(291) VOID NTAPI xboxkrnl::RtlInitializeCriticalSection { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - /* - printf("EmuKrnl (0x%X): RtlInitializeCriticalSection\n" - "(\n" - " CriticalSection : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), CriticalSection); - //*/ - } - #endif + /* + DbgPrintf("EmuKrnl (0x%X): RtlInitializeCriticalSection\n" + "(\n" + " CriticalSection : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), CriticalSection); + //*/ NtDll::RtlInitializeCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection); @@ -2568,18 +2280,13 @@ XBSYSAPI EXPORTNUM(294) VOID NTAPI xboxkrnl::RtlLeaveCriticalSection // Note: We need to execute this before debug output to avoid trouble NtDll::RtlLeaveCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection); - // debug trace - #ifdef _DEBUG_TRACE - { - /* sorta pointless - printf("EmuKrnl (0x%X): RtlLeaveCriticalSection\n" - "(\n" - " CriticalSection : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), CriticalSection); - //*/ - } - #endif + /* sorta pointless + DbgPrintf("EmuKrnl (0x%X): RtlLeaveCriticalSection\n" + "(\n" + " CriticalSection : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), CriticalSection); + //*/ EmuSwapFS(); // Xbox FS @@ -2596,16 +2303,11 @@ XBSYSAPI EXPORTNUM(301) xboxkrnl::ULONG NTAPI xboxkrnl::RtlNtStatusToDosError { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): RtlNtStatusToDosError\n" - "(\n" - " Status : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Status); - } - #endif + DbgPrintf("EmuKrnl (0x%X): RtlNtStatusToDosError\n" + "(\n" + " Status : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Status); ULONG ret = NtDll::RtlNtStatusToDosError(Status); @@ -2625,17 +2327,12 @@ XBSYSAPI EXPORTNUM(304) xboxkrnl::BOOLEAN NTAPI xboxkrnl::RtlTimeFieldsToTime { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): RtlTimeFieldsToTime\n" - "(\n" - " TimeFields : 0x%.08X\n" - " Time : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), TimeFields, Time); - } - #endif + DbgPrintf("EmuKrnl (0x%X): RtlTimeFieldsToTime\n" + "(\n" + " TimeFields : 0x%.08X\n" + " Time : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), TimeFields, Time); BOOLEAN bRet = NtDll::RtlTimeFieldsToTime((NtDll::TIME_FIELDS*)TimeFields, (NtDll::LARGE_INTEGER*)Time); @@ -2655,17 +2352,12 @@ XBSYSAPI EXPORTNUM(305) VOID NTAPI xboxkrnl::RtlTimeToTimeFields { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): RtlTimeToTimeFields\n" - "(\n" - " Time : 0x%.08X\n" - " TimeFields : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Time, TimeFields); - } - #endif + DbgPrintf("EmuKrnl (0x%X): RtlTimeToTimeFields\n" + "(\n" + " Time : 0x%.08X\n" + " TimeFields : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Time, TimeFields); NtDll::RtlTimeToTimeFields((NtDll::LARGE_INTEGER*)Time, (NtDll::TIME_FIELDS*)TimeFields); @@ -2686,18 +2378,13 @@ XBSYSAPI EXPORTNUM(308) xboxkrnl::NTSTATUS NTAPI xboxkrnl::RtlUnicodeStringToAns { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): RtlUnicodeStringToAnsiString\n" - "(\n" - " DestinationString : 0x%.08X\n" - " SourceString : 0x%.08X\n" - " AllocateDestinationString : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), DestinationString, SourceString, AllocateDestinationString); - } - #endif + DbgPrintf("EmuKrnl (0x%X): RtlUnicodeStringToAnsiString\n" + "(\n" + " DestinationString : 0x%.08X\n" + " SourceString : 0x%.08X\n" + " AllocateDestinationString : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), DestinationString, SourceString, AllocateDestinationString); NTSTATUS ret = NtDll::RtlUnicodeStringToAnsiString((NtDll::STRING*)DestinationString, (NtDll::UNICODE_STRING*)SourceString, AllocateDestinationString); @@ -2743,16 +2430,11 @@ XBSYSAPI EXPORTNUM(335) VOID NTAPI xboxkrnl::XcSHAInit(UCHAR *pbSHAContext) { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): XcSHAInit\n" - "(\n" - " pbSHAContext : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pbSHAContext); - } - #endif + DbgPrintf("EmuKrnl (0x%X): XcSHAInit\n" + "(\n" + " pbSHAContext : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pbSHAContext); EmuSwapFS(); // Xbox FS @@ -2766,18 +2448,13 @@ XBSYSAPI EXPORTNUM(336) VOID NTAPI xboxkrnl::XcSHAUpdate(UCHAR *pbSHAContext, UC { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): XcSHAUpdate\n" - "(\n" - " pbSHAContext : 0x%.08X\n" - " pbInput : 0x%.08X\n" - " dwInputLength : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pbSHAContext, pbInput, dwInputLength); - } - #endif + DbgPrintf("EmuKrnl (0x%X): XcSHAUpdate\n" + "(\n" + " pbSHAContext : 0x%.08X\n" + " pbInput : 0x%.08X\n" + " dwInputLength : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pbSHAContext, pbInput, dwInputLength); EmuSwapFS(); // Xbox FS @@ -2791,17 +2468,12 @@ XBSYSAPI EXPORTNUM(337) VOID NTAPI xboxkrnl::XcSHAFinal(UCHAR *pbSHAContext, UCH { EmuSwapFS(); // Win2k/XP FS - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuKrnl (0x%X): XcSHAFinal\n" - "(\n" - " pbSHAContext : 0x%.08X\n" - " pbDigest : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pbSHAContext, pbDigest); - } - #endif + DbgPrintf("EmuKrnl (0x%X): XcSHAFinal\n" + "(\n" + " pbSHAContext : 0x%.08X\n" + " pbDigest : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pbSHAContext, pbDigest); // for now, we dont care about the digest for(int v=0;v<16;v++) diff --git a/Source/Win32/CxbxKrnl/EmuXG.cpp b/Source/Win32/CxbxKrnl/EmuXG.cpp index e8a5af1f0..beb7cdea8 100644 --- a/Source/Win32/CxbxKrnl/EmuXG.cpp +++ b/Source/Win32/CxbxKrnl/EmuXG.cpp @@ -70,7 +70,7 @@ PVOID WINAPI XTL::EmuXGIsSwizzledFormat #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuXapi (0x%X): EmuXGIsSwizzledFormat\n" + DbgPrintf("EmuXapi (0x%X): EmuXGIsSwizzledFormat\n" "(\n" " Format : 0x%.08X\n" ");\n", @@ -99,26 +99,19 @@ VOID WINAPI XTL::EmuXGSwizzleRect { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuXGSwizzleRect\n" - "(\n" - " pSource : 0x%.08X\n" - " Pitch : 0x%.08X\n" - " pRect : 0x%.08X\n" - " pDest : 0x%.08X\n" - " Width : 0x%.08X\n" - " Height : 0x%.08X\n" - " pPoint : 0x%.08X\n" - " BytesPerPixel : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pSource, Pitch, pRect, pDest, Width, Height, - pPoint, BytesPerPixel); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuXGSwizzleRect\n" + "(\n" + " pSource : 0x%.08X\n" + " Pitch : 0x%.08X\n" + " pRect : 0x%.08X\n" + " pDest : 0x%.08X\n" + " Width : 0x%.08X\n" + " Height : 0x%.08X\n" + " pPoint : 0x%.08X\n" + " BytesPerPixel : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pSource, Pitch, pRect, pDest, Width, Height, + pPoint, BytesPerPixel); if(pRect == NULL && pPoint == NULL && Pitch == 0) { @@ -176,28 +169,21 @@ VOID WINAPI XTL::EmuXGSwizzleBox { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuXGSwizzleBox\n" - "(\n" - " pSource : 0x%.08X\n" - " RowPitch : 0x%.08X\n" - " SlicePitch : 0x%.08X\n" - " pBox : 0x%.08X\n" - " pDest : 0x%.08X\n" - " Width : 0x%.08X\n" - " Height : 0x%.08X\n" - " Depth : 0x%.08X\n" - " pPoint : 0x%.08X\n" - " BytesPerPixel : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pSource, RowPitch, SlicePitch, pBox, pDest, Width, Height, - Depth, pPoint, BytesPerPixel); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuXGSwizzleBox\n" + "(\n" + " pSource : 0x%.08X\n" + " RowPitch : 0x%.08X\n" + " SlicePitch : 0x%.08X\n" + " pBox : 0x%.08X\n" + " pDest : 0x%.08X\n" + " Width : 0x%.08X\n" + " Height : 0x%.08X\n" + " Depth : 0x%.08X\n" + " pPoint : 0x%.08X\n" + " BytesPerPixel : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pSource, RowPitch, SlicePitch, pBox, pDest, Width, Height, + Depth, pPoint, BytesPerPixel); if(pBox == NULL && pPoint == NULL && RowPitch == 0 && SlicePitch == 0) { diff --git a/Source/Win32/CxbxKrnl/EmuXOnline.cpp b/Source/Win32/CxbxKrnl/EmuXOnline.cpp index 8534fdfd5..ac770ee5f 100644 --- a/Source/Win32/CxbxKrnl/EmuXOnline.cpp +++ b/Source/Win32/CxbxKrnl/EmuXOnline.cpp @@ -64,19 +64,12 @@ int WINAPI XTL::EmuWSAStartup { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuWSAStartup\n" - "(\n" - " wVersionRequested : 0x%.08X\n" - " lpWSAData : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), wVersionRequested, lpWSAData); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuWSAStartup\n" + "(\n" + " wVersionRequested : 0x%.08X\n" + " lpWSAData : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), wVersionRequested, lpWSAData); int ret = XTL::WSAStartup(wVersionRequested, lpWSAData); @@ -95,18 +88,11 @@ INT WINAPI XTL::EmuXNetStartup { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuXNetStartup\n" - "(\n" - " pDummy : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pDummy); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuXNetStartup\n" + "(\n" + " pDummy : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pDummy); EmuSwapFS(); // XBox FS @@ -121,14 +107,7 @@ DWORD WINAPI XTL::EmuXNetGetEthernetLinkStatus() { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuXNetGetEthernetLinkStatus();\n", GetCurrentThreadId()); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuXNetGetEthernetLinkStatus();\n", GetCurrentThreadId()); EmuSwapFS(); // XBox FS @@ -148,21 +127,14 @@ SOCKET XTL::EmuThis::Emusocket { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuThis::Emusocket\n" - "(\n" - " this : 0x%.08X\n" - " af : 0x%.08X\n" - " type : 0x%.08X\n" - " protocol : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), this, af, type, protocol); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuThis::Emusocket\n" + "(\n" + " this : 0x%.08X\n" + " af : 0x%.08X\n" + " type : 0x%.08X\n" + " protocol : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), this, af, type, protocol); SOCKET ret = socket(af, type, protocol); @@ -178,21 +150,14 @@ int XTL::EmuThis::Emubind(SOCKET s, const struct sockaddr FAR *name, int namelen { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuThis::Emubind\n" - "(\n" - " this : 0x%.08X\n" - " s : 0x%.08X\n" - " name : 0x%.08X\n" - " namelen : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), this, s, name, namelen); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuThis::Emubind\n" + "(\n" + " this : 0x%.08X\n" + " s : 0x%.08X\n" + " name : 0x%.08X\n" + " namelen : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), this, s, name, namelen); // TODO: Host-To-Network order if necessary (probably not?) @@ -210,20 +175,13 @@ int XTL::EmuThis::Emulisten(SOCKET s, int backlog) { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuThis::Emulisten\n" - "(\n" - " this : 0x%.08X\n" - " s : 0x%.08X\n" - " listen : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), this, s, backlog); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuThis::Emulisten\n" + "(\n" + " this : 0x%.08X\n" + " s : 0x%.08X\n" + " listen : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), this, s, backlog); // TODO: Host-To-Network order if necessary (probably not?) @@ -241,21 +199,14 @@ int XTL::EmuThis::Emuioctlsocket(SOCKET s, long cmd, u_long FAR *argp) { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuThis::Emuioctlsocket\n" - "(\n" - " this : 0x%.08X\n" - " s : 0x%.08X\n" - " cmd : 0x%.08X\n" - " argp : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), this, s, cmd, argp); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuThis::Emuioctlsocket\n" + "(\n" + " this : 0x%.08X\n" + " s : 0x%.08X\n" + " cmd : 0x%.08X\n" + " argp : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), this, s, cmd, argp); int ret = ioctlsocket(s, cmd, argp); diff --git a/Source/Win32/CxbxKrnl/EmuXapi.cpp b/Source/Win32/CxbxKrnl/EmuXapi.cpp index e33566312..4a6c5177b 100644 --- a/Source/Win32/CxbxKrnl/EmuXapi.cpp +++ b/Source/Win32/CxbxKrnl/EmuXapi.cpp @@ -78,23 +78,16 @@ PVOID WINAPI XTL::EmuRtlCreateHeap { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuRtlCreateHeap\n" - "(\n" - " Flags : 0x%.08X\n" - " Base : 0x%.08X\n" - " Reserve : 0x%.08X\n" - " Commit : 0x%.08X\n" - " Lock : 0x%.08X\n" - " RtlHeapParams : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Flags, Base, Reserve, Commit, Lock, RtlHeapParams); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuRtlCreateHeap\n" + "(\n" + " Flags : 0x%.08X\n" + " Base : 0x%.08X\n" + " Reserve : 0x%.08X\n" + " Commit : 0x%.08X\n" + " Lock : 0x%.08X\n" + " RtlHeapParams : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Flags, Base, Reserve, Commit, Lock, RtlHeapParams); NtDll::RTL_HEAP_DEFINITION RtlHeapDefinition; @@ -121,22 +114,15 @@ PVOID WINAPI XTL::EmuRtlAllocateHeap { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - /* too much debug output - printf("EmuXapi (0x%X): EmuRtlAllocateHeap\n" - "(\n" - " hHeap : 0x%.08X\n" - " dwFlags : 0x%.08X\n" - " dwBytes : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hHeap, dwFlags, dwBytes); - //*/ - } - #endif + /* too much debug output + DbgPrintf("EmuXapi (0x%X): EmuRtlAllocateHeap\n" + "(\n" + " hHeap : 0x%.08X\n" + " dwFlags : 0x%.08X\n" + " dwBytes : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hHeap, dwFlags, dwBytes); + //*/ PVOID pRet = NtDll::RtlAllocateHeap(hHeap, dwFlags, dwBytes); @@ -157,22 +143,15 @@ BOOL WINAPI XTL::EmuRtlFreeHeap { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - /* too much debug output - printf("EmuXapi (0x%X): EmuRtlFreeHeap\n" - "(\n" - " hHeap : 0x%.08X\n" - " dwFlags : 0x%.08X\n" - " lpMem : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hHeap, dwFlags, lpMem); - //*/ - } - #endif + /* too much debug output + DbgPrintf("EmuXapi (0x%X): EmuRtlFreeHeap\n" + "(\n" + " hHeap : 0x%.08X\n" + " dwFlags : 0x%.08X\n" + " lpMem : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hHeap, dwFlags, lpMem); + //*/ BOOL bRet = NtDll::RtlFreeHeap(hHeap, dwFlags, lpMem); @@ -194,23 +173,16 @@ PVOID WINAPI XTL::EmuRtlReAllocateHeap { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - //* too much debug output - printf("EmuXapi (0x%X): EmuRtlReAllocateHeap\n" - "(\n" - " hHeap : 0x%.08X\n" - " dwFlags : 0x%.08X\n" - " lpMem : 0x%.08X\n" - " dwBytes : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hHeap, dwFlags, lpMem, dwBytes); - //*/ - } - #endif + /* too much debug output + DbgPrintf("EmuXapi (0x%X): EmuRtlReAllocateHeap\n" + "(\n" + " hHeap : 0x%.08X\n" + " dwFlags : 0x%.08X\n" + " lpMem : 0x%.08X\n" + " dwBytes : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hHeap, dwFlags, lpMem, dwBytes); + //*/ PVOID pRet = NtDll::RtlReAllocateHeap(hHeap, dwFlags, lpMem, dwBytes); @@ -231,22 +203,15 @@ SIZE_T WINAPI XTL::EmuRtlSizeHeap { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - /* too much debug output - printf("EmuXapi (0x%X): EmuRtlSizeHeap\n" - "(\n" - " hHeap : 0x%.08X\n" - " dwFlags : 0x%.08X\n" - " lpMem : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hHeap, dwFlags, lpMem); - //*/ - } - #endif + /* too much debug output + DbgPrintf("EmuXapi (0x%X): EmuRtlSizeHeap\n" + "(\n" + " hHeap : 0x%.08X\n" + " dwFlags : 0x%.08X\n" + " lpMem : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hHeap, dwFlags, lpMem); + //*/ SIZE_T ret = NtDll::RtlSizeHeap(hHeap, dwFlags, lpMem); @@ -265,18 +230,11 @@ BOOL WINAPI XTL::EmuQueryPerformanceCounter { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuQueryPerformanceCounter\n" - "(\n" - " lpPerformanceCount : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), lpPerformanceCount); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuQueryPerformanceCounter\n" + "(\n" + " lpPerformanceCount : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), lpPerformanceCount); BOOL bRet = QueryPerformanceCounter(lpPerformanceCount); @@ -295,18 +253,11 @@ BOOL WINAPI XTL::EmuQueryPerformanceFrequency { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuQueryPerformanceFrequency\n" - "(\n" - " lpFrequency : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), lpFrequency); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuQueryPerformanceFrequency\n" + "(\n" + " lpFrequency : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), lpFrequency); BOOL bRet = QueryPerformanceFrequency(lpFrequency); @@ -323,13 +274,10 @@ BOOL WINAPI XTL::EmuXMountUtilityDrive BOOL fFormatClean ) { - // ****************************************************************** - // * debug trace - // ****************************************************************** #ifdef _DEBUG_TRACE { EmuSwapFS(); // Win2k/XP FS - printf("EmuXapi (0x%X): EmuXMountUtilityDrive\n" + DbgPrintf("EmuXapi (0x%X): EmuXMountUtilityDrive\n" "(\n" " fFormatClean : 0x%.08X\n" ");\n", @@ -352,19 +300,12 @@ VOID WINAPI XTL::EmuXInitDevices { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuXInitDevices\n" - "(\n" - " Unknown1 : 0x%.08X\n" - " Unknown2 : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Unknown1, Unknown2); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuXInitDevices\n" + "(\n" + " Unknown1 : 0x%.08X\n" + " Unknown2 : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Unknown1, Unknown2); // TODO: Initialize devices if/when necessary @@ -383,18 +324,11 @@ DWORD WINAPI XTL::EmuXGetDevices { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuXGetDevices\n" - "(\n" - " DeviceType : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), DeviceType); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuXGetDevices\n" + "(\n" + " DeviceType : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), DeviceType); DWORD ret = 0; @@ -420,20 +354,13 @@ BOOL WINAPI XTL::EmuXGetDeviceChanges { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuXGetDeviceChanges\n" - "(\n" - " DeviceType : 0x%.08X\n" - " pdwInsertions : 0x%.08X\n" - " pdwRemovals : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), DeviceType, pdwInsertions, pdwRemovals); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuXGetDeviceChanges\n" + "(\n" + " DeviceType : 0x%.08X\n" + " pdwInsertions : 0x%.08X\n" + " pdwRemovals : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), DeviceType, pdwInsertions, pdwRemovals); BOOL bRet = FALSE; BOOL bFirst = TRUE; @@ -469,21 +396,14 @@ HANDLE WINAPI XTL::EmuXInputOpen { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuXInputOpen\n" - "(\n" - " DeviceType : 0x%.08X\n" - " dwPort : 0x%.08X\n" - " dwSlot : 0x%.08X\n" - " pPollingParameters : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), DeviceType, dwPort, dwSlot, pPollingParameters); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuXInputOpen\n" + "(\n" + " DeviceType : 0x%.08X\n" + " dwPort : 0x%.08X\n" + " dwSlot : 0x%.08X\n" + " pPollingParameters : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), DeviceType, dwPort, dwSlot, pPollingParameters); HANDLE ret = NULL; @@ -506,18 +426,11 @@ VOID WINAPI XTL::EmuXInputClose { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuXInputClose\n" - "(\n" - " hDevice : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hDevice); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuXInputClose\n" + "(\n" + " hDevice : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hDevice); // TODO: Actually clean up the device when/if necessary @@ -537,19 +450,12 @@ DWORD WINAPI XTL::EmuXInputGetCapabilities { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuXInputGetCapabilities\n" - "(\n" - " hDevice : 0x%.08X\n" - " pCapabilities : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hDevice, pCapabilities); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuXInputGetCapabilities\n" + "(\n" + " hDevice : 0x%.08X\n" + " pCapabilities : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hDevice, pCapabilities); DWORD ret = ERROR_INVALID_HANDLE; @@ -579,19 +485,12 @@ DWORD WINAPI XTL::EmuXInputGetState { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuXInputGetState\n" - "(\n" - " hDevice : 0x%.08X\n" - " pState : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hDevice, pState); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuXInputGetState\n" + "(\n" + " hDevice : 0x%.08X\n" + " pState : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hDevice, pState); DWORD ret = ERROR_INVALID_HANDLE; @@ -622,19 +521,12 @@ DWORD WINAPI XTL::EmuXInputSetState { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuXInputSetState\n" - "(\n" - " hDevice : 0x%.08X\n" - " pFeedback : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hDevice, pFeedback); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuXInputSetState\n" + "(\n" + " hDevice : 0x%.08X\n" + " pFeedback : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hDevice, pFeedback); pFeedback->Header.dwStatus = ERROR_IO_PENDING; @@ -697,20 +589,13 @@ HANDLE WINAPI XTL::EmuCreateMutex { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuCreateMutex\n" - "(\n" - " lpMutexAttributes : 0x%.08X\n" - " bInitialOwner : 0x%.08X\n" - " lpName : 0x%.08X (%s)\n" - ");\n", - GetCurrentThreadId(), lpMutexAttributes, bInitialOwner, lpName, lpName); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuCreateMutex\n" + "(\n" + " lpMutexAttributes : 0x%.08X\n" + " bInitialOwner : 0x%.08X\n" + " lpName : 0x%.08X (%s)\n" + ");\n", + GetCurrentThreadId(), lpMutexAttributes, bInitialOwner, lpName, lpName); HANDLE hRet = CreateMutex((SECURITY_ATTRIBUTES *)lpMutexAttributes, bInitialOwner, lpName); @@ -729,18 +614,11 @@ BOOL WINAPI XTL::EmuCloseHandle { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuCloseHandle\n" - "(\n" - " hObject : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hObject); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuCloseHandle\n" + "(\n" + " hObject : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hObject); BOOL bRet = CloseHandle(hObject); @@ -760,19 +638,12 @@ BOOL WINAPI XTL::EmuSetThreadPriorityBoost { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuSetThreadPriorityBoost\n" - "(\n" - " hThread : 0x%.08X\n" - " DisablePriorityBoost: 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hThread, DisablePriorityBoost); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuSetThreadPriorityBoost\n" + "(\n" + " hThread : 0x%.08X\n" + " DisablePriorityBoost: 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hThread, DisablePriorityBoost); BOOL bRet = SetThreadPriorityBoost(hThread, DisablePriorityBoost); @@ -795,19 +666,12 @@ BOOL WINAPI XTL::EmuSetThreadPriority { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuSetThreadPriority\n" - "(\n" - " hThread : 0x%.08X\n" - " nPriority : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hThread, nPriority); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuSetThreadPriority\n" + "(\n" + " hThread : 0x%.08X\n" + " nPriority : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hThread, nPriority); BOOL bRet = SetThreadPriority(hThread, nPriority); @@ -830,18 +694,11 @@ int WINAPI XTL::EmuGetThreadPriority { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuGetThreadPriority\n" - "(\n" - " hThread : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hThread); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuGetThreadPriority\n" + "(\n" + " hThread : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hThread); int iRet = GetThreadPriority(hThread); @@ -864,19 +721,12 @@ BOOL WINAPI XTL::EmuGetExitCodeThread { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuGetExitCodeThread\n" - "(\n" - " hThread : 0x%.08X\n" - " lpExitCode : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hThread, lpExitCode); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuGetExitCodeThread\n" + "(\n" + " hThread : 0x%.08X\n" + " lpExitCode : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hThread, lpExitCode); BOOL bRet = GetExitCodeThread(hThread, lpExitCode); @@ -892,14 +742,7 @@ VOID WINAPI XTL::EmuXapiInitProcess() { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuXapiInitProcess();\n", GetCurrentThreadId()); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuXapiInitProcess();\n", GetCurrentThreadId()); // ****************************************************************** // * Call RtlCreateHeap @@ -947,19 +790,12 @@ VOID WINAPI XTL::EmuXapiThreadStartup { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuXapiThreadStartup\n" - "(\n" - " dwDummy1 : 0x%.08X\n" - " dwDummy2 : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), dwDummy1, dwDummy2); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuXapiThreadStartup\n" + "(\n" + " dwDummy1 : 0x%.08X\n" + " dwDummy2 : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), dwDummy1, dwDummy2); EmuSwapFS(); // XBox FS @@ -982,19 +818,12 @@ XTL::NTSTATUS CDECL XTL::XapiSetupPerTitleDriveLetters(DWORD dwTitleId, LPCWSTR { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): XapiSetupPerTitleDriveLetters\n" - "(\n" - " dwTitleId : 0x%.08X\n" - " wszTitleName : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), dwTitleId, wszTitleName); - } - #endif + DbgPrintf("EmuXapi (0x%X): XapiSetupPerTitleDriveLetters\n" + "(\n" + " dwTitleId : 0x%.08X\n" + " wszTitleName : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), dwTitleId, wszTitleName); NTSTATUS ret = STATUS_SUCCESS; @@ -1010,20 +839,13 @@ VOID WINAPI XTL::EmuXapiBootDash(DWORD UnknownA, DWORD UnknownB, DWORD UnknownC) { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuXapiBootDash\n" - "(\n" - " UnknownA : 0x%.08X\n" - " UnknownB : 0x%.08X\n" - " UnknownC : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), UnknownA, UnknownB, UnknownC); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuXapiBootDash\n" + "(\n" + " UnknownA : 0x%.08X\n" + " UnknownB : 0x%.08X\n" + " UnknownC : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), UnknownA, UnknownB, UnknownC); EmuCleanup("Emulation Terminated (XapiBootDash)"); @@ -1043,19 +865,12 @@ VOID WINAPI XTL::EmuXRegisterThreadNotifyRoutine { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): EmuXRegisterThreadNotifyRoutine\n" - "(\n" - " pThreadNotification : 0x%.08X (0x%.08X)\n" - " fRegister : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThreadNotification, pThreadNotification->pfnNotifyRoutine, fRegister); - } - #endif + DbgPrintf("EmuXapi (0x%X): EmuXRegisterThreadNotifyRoutine\n" + "(\n" + " pThreadNotification : 0x%.08X (0x%.08X)\n" + " fRegister : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThreadNotification, pThreadNotification->pfnNotifyRoutine, fRegister); if(fRegister) { @@ -1084,18 +899,11 @@ HANDLE WINAPI XTL::EmuXCalculateSignatureBegin { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): XCalculateSignatureBegin\n" - "(\n" - " dwFlags : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), dwFlags); - } - #endif + DbgPrintf("EmuXapi (0x%X): XCalculateSignatureBegin\n" + "(\n" + " dwFlags : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), dwFlags); EmuSwapFS(); // XBox FS @@ -1114,19 +922,12 @@ HANDLE WINAPI XTL::EmuXCalculateSignatureBeginEx { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): XCalculateSignatureBeginEx\n" - "(\n" - " dwFlags : 0x%.08X\n", - " dwAltTitleId : 0x%.08X\n", - ");\n", - GetCurrentThreadId(), dwFlags, dwAltTitleId); - } - #endif + DbgPrintf("EmuXapi (0x%X): XCalculateSignatureBeginEx\n" + "(\n" + " dwFlags : 0x%.08X\n", + " dwAltTitleId : 0x%.08X\n", + ");\n", + GetCurrentThreadId(), dwFlags, dwAltTitleId); EmuSwapFS(); // XBox FS @@ -1146,20 +947,13 @@ DWORD WINAPI XTL::EmuXCalculateSignatureUpdate { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): XCalculateSignatureUpdate\n" - "(\n" - " hCalcSig : 0x%.08X\n", - " pbData : 0x%.08X\n", - " cbData : 0x%.08X\n", - ");\n", - GetCurrentThreadId(), hCalcSig, pbData, cbData); - } - #endif + DbgPrintf("EmuXapi (0x%X): XCalculateSignatureUpdate\n" + "(\n" + " hCalcSig : 0x%.08X\n", + " pbData : 0x%.08X\n", + " cbData : 0x%.08X\n", + ");\n", + GetCurrentThreadId(), hCalcSig, pbData, cbData); EmuSwapFS(); // XBox FS @@ -1177,19 +971,12 @@ DWORD WINAPI XTL::EmuXCalculateSignatureEnd { EmuSwapFS(); // Win2k/XP FS - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - printf("EmuXapi (0x%X): XCalculateSignatureEnd\n" - "(\n" - " hCalcSig : 0x%.08X\n", - " pSignature : 0x%.08X\n", - ");\n", - GetCurrentThreadId(), hCalcSig, pSignature); - } - #endif + DbgPrintf("EmuXapi (0x%X): XCalculateSignatureEnd\n" + "(\n" + " hCalcSig : 0x%.08X\n", + " pSignature : 0x%.08X\n", + ");\n", + GetCurrentThreadId(), hCalcSig, pSignature); EmuSwapFS(); // XBox FS