//********************************************************************************
// Dump Subroutines
//********************************************************************************
// カムイデバッグ用各種データダンプルーチン
#include	<stdio.h>				/* for "sprintf" */
#include	<windows.h>
#include	"kamui.h"				/* for Kamui Call */

//********************************************************************************
// Dump Surface Descriptor
//********************************************************************************
// Surface Descriptorの内容を指定されたファイル名のファイルにダンプする。
// 出力形式はテキストファイル
void	debug_dump_SurfaceDesc(unsigned char *fname,PKMSURFACEDESC	pSurfaceDesc)
{
	unsigned char			buff[256];		// 出力バッファ
	unsigned char			str[256];		// 文字列バッファ
	HANDLE	hFile;
	int		bytes;
	UINT	fResult;
	DWORD	nWrited;

	/* ファイルのオープン ***************************************************************/
	hFile = CreateFile(	fname,						/* ファイル名 */
						GENERIC_WRITE,				/* ファイル書き込みの指定 */
						0,							/* シェアモード：シェアしない */
						NULL,						/* セキュリティアトリビュート：省略 */
						CREATE_ALWAYS,				/* 常に新規生成 */
						FILE_ATTRIBUTE_NORMAL,		/* ファイルのアトリビュート指定：普通 */
						NULL						/* テンプレートファイル：なし */
						);
	/* Surface Descriptorのダンプ *******************************************************/
	bytes = sprintf(buff,"** Surface Descriptor *******************\n"); fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// Address ----------------------------------------------------------
	bytes = sprintf(buff," Address        : %08Xh(%s)\n",pSurfaceDesc);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// SurfaceType ------------------------------------------------------
	switch(pSurfaceDesc->SurfaceType){
	case KM_SURFACETYPE_FRAMEBUFFER:	strcpy(str,"KM_SURFACETYPE_FRAMEBUFFER");	break;
	case KM_SURFACETYPE_TEXTURE:		strcpy(str,"KM_SURFACETYPE_TEXTURE");	break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," SurfaceType    : %08Xh(%s)\n",pSurfaceDesc->SurfaceType,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// BitDepth ------------------------------------------------------
	switch(pSurfaceDesc->BitDepth){
	case KM_BITDEPTH_16:	strcpy(str,"KM_BITDEPTH_16");	break;
	case KM_BITDEPTH_24:	strcpy(str,"KM_BITDEPTH_24");	break;
	case KM_BITDEPTH_32:	strcpy(str,"KM_BITDEPTH_32");	break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," BitDepth       : %08Xh(%s)\n",pSurfaceDesc->BitDepth,str);		fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// PixelFormat ------------------------------------------------------
	switch(pSurfaceDesc->PixelFormat){
	case KM_PIXELFORMAT_ARGB1555:			strcpy(str,"KM_PIXELFORMAT_ARGB1555");	break;
	case KM_PIXELFORMAT_RGB565:				strcpy(str,"KM_PIXELFORMAT_RGB565");	break;
	case KM_PIXELFORMAT_ARGB4444:			strcpy(str,"KM_PIXELFORMAT_ARGB4444");	break;
	case KM_PIXELFORMAT_YUV422:				strcpy(str,"KM_PIXELFORMAT_YUV422");	break;
	case KM_PIXELFORMAT_BUMP:				strcpy(str,"KM_PIXELFORMAT_BUMP");	break;
	case KM_PIXELFORMAT_PALETTIZED_4BPP:	strcpy(str,"KM_PIXELFORMAT_PALETTIZED_4BPP");	break;
	case KM_PIXELFORMAT_PALETTIZED_8BPP:	strcpy(str,"KM_PIXELFORMAT_PALETTIZED_8BPP");	break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," PixelFormat    : %08Xh(%s)\n",pSurfaceDesc->PixelFormat,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// USize, VSize ------------------------------------------------------
	bytes = sprintf(buff," USize / Width  : %08Xh(%d)\n",pSurfaceDesc->USize,pSurfaceDesc->USize);			fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	bytes = sprintf(buff," VSize / Height : %08Xh(%d)\n",pSurfaceDesc->VSize,pSurfaceDesc->VSize);			fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	bytes = sprintf(buff," dwTextureSize  : %08Xh(%d)\n",pSurfaceDesc->dwTextureSize,pSurfaceDesc->dwTextureSize);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	bytes = sprintf(buff," fSurfaceFlags  : %08Xh\n",pSurfaceDesc->fSurfaceFlags);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	bytes = sprintf(buff," pSurface       : %08Xh\n",pSurfaceDesc->pSurface);fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// Comments ------------------------------------------------------
	bytes = sprintf(buff,"\n-- fSurfaceFlags --\n");fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	bytes = sprintf(buff," KM_SURFACEFLAGS_MIPMAPED     0x001\n");fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	bytes = sprintf(buff," KM_SURFACEFLAGS_CHROMAKEYFIX 0x002\n");fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	bytes = sprintf(buff," KM_SURFACEFLAGS_TWIDDLED     0x004\n");fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	bytes = sprintf(buff," KM_SURFACEFLAGS_VQ           0x008\n");fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	bytes = sprintf(buff," KM_SURFACEFLAGS_STRIDE       0x010\n");fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	bytes = sprintf(buff," KM_SURFACEFLAGS_PALETTIZED   0x020\n");fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	/* ファイルのクローズ ***************************************************************/
	CloseHandle(hFile);							/* ファイルクローズ */
}

//********************************************************************************
// Dump Vertex Context
//********************************************************************************
// Vertex Contextの内容を指定されたファイル名のファイルにダンプする。
// 出力形式はテキストファイル
void	debug_dump_VertexContext(unsigned char *fname,
								PKMVERTEXCONTEXT pVertexContext
								 )
{
	unsigned char			buff[256];		// 出力バッファ
	unsigned char			str[256];		// 文字列バッファ
	HANDLE	hFile;
	int		bytes;
	UINT	fResult;
	DWORD	nWrited;

	/* ファイルのオープン ***************************************************************/
	hFile = CreateFile(	fname,						/* ファイル名 */
						GENERIC_WRITE,				/* ファイル書き込みの指定 */
						0,							/* シェアモード：シェアしない */
						NULL,						/* セキュリティアトリビュート：省略 */
						CREATE_ALWAYS,				/* 常に新規生成 */
						FILE_ATTRIBUTE_NORMAL,		/* ファイルのアトリビュート指定：普通 */
						NULL						/* テンプレートファイル：なし */
						);
	/* Vertex Contextのダンプ ***********************************************************/
	bytes = sprintf(buff,"** Vertex Context *******************\n"); fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// Address ----------------------------------------------------------
	bytes = sprintf(buff," Address            : %08Xh(%s)\n",pVertexContext);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// ParamType ------------------------------------------------------
	switch(pVertexContext->ParamType){
	case KM_POLYGON:			strcpy(str,"KM_POLYGON"); break;
	case KM_MODIFIERVOLUME:		strcpy(str,"KM_MODIFIERVOLUME"); break;
	case KM_SPRITE:				strcpy(str,"KM_SPRITE"); break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," ParamType          : %08Xh(%s)\n",pVertexContext->ParamType,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// ListType ------------------------------------------------------
	switch(pVertexContext->ListType){
	case KM_OPAQUE_POLYGON:		strcpy(str,"KM_OPAQUE_POLYGON");	break;
	case KM_OPAQUE_MODIFIER:	strcpy(str,"KM_OPAQUE_MODIFIER");	break;
	case KM_TRANS_POLYGON:		strcpy(str,"KM_TRANS_POLYGON");		break;
	case KM_TRANS_MODIFIER:		strcpy(str,"KM_TRANS_MODIFIER");	break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," ListType           : %08Xh(%s)\n",pVertexContext->ListType,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// ColorType ------------------------------------------------------
	switch(pVertexContext->ColorType){
	case KM_PACKEDCOLOR:	strcpy(str,"KM_PACKEDCOLOR");	break;
	case KM_FLOATINGCOLOR:	strcpy(str,"KM_FLOATINGCOLOR");	break;
	case KM_INTENSITY:		strcpy(str,"KM_INTENSITY");		break;
//	case KM_INTENSITY_PREV_FACE_COL:	strcpy(str,"KM_INTENSITY_PREV_FACE_COL");	break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," ColorType          : %08Xh(%s)\n",pVertexContext->ColorType,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// UVFormat ------------------------------------------------------
	switch(pVertexContext->UVFormat){
	case KM_32BITUV:	strcpy(str,"KM_32BITUV");	break;
	case KM_16BITUV:	strcpy(str,"KM_16BITUV");	break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," UVFormat           : %08Xh(%s)\n",pVertexContext->UVFormat,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// DepthMode ------------------------------------------------------
	switch(pVertexContext->DepthMode){
	case KM_IGNORE:			strcpy(str,"KM_IGNORE");		break;
	case KM_LESS:			strcpy(str,"KM_LESS");			break;
	case KM_EQUAL:			strcpy(str,"KM_EQUAL");			break;
//	case KM_LESSEQUAL:		strcpy(str,"KM_LESSEQUAL");		break;
	case KM_GREATER:		strcpy(str,"KM_GREATER");		break;
	case KM_NOTEQUAL:		strcpy(str,"KM_NOTEQUAL");		break;
	case KM_GREATEREQUAL:	strcpy(str,"KM_GREATEREQUAL");	break;
	case KM_ALWAYS:			strcpy(str,"KM_ALWAYS");		break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," DepthMode          : %08Xh(%s)\n",pVertexContext->DepthMode,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// CullingMode ------------------------------------------------------
	switch(pVertexContext->CullingMode){
	case KM_NOCULLING:	strcpy(str,"KM_NOCULLING");		break;
	case KM_CULLSMALL:	strcpy(str,"KM_CULLSMALL");		break;
	case KM_CULLACW:	strcpy(str,"KM_CULLACW");		break;
	case KM_CULLCW:		strcpy(str,"KM_CULLCW");		break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," CullingMode        : %08Xh(%s)\n",pVertexContext->CullingMode,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// ScreenCoordination ------------------------------------------------------
	switch(pVertexContext->ScreenCoordination){
	case KM_SCREEN:		strcpy(str,"KM_SCREEN");		break;
	case KM_PROJECTIVE:	strcpy(str,"KM_PROJECTIVE");	break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," ScreenCoordination : %08Xh(%s)\n",pVertexContext->ScreenCoordination,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// ShadingMode ------------------------------------------------------------
	switch(pVertexContext->ShadingMode){
	case KM_NOTEXTUREFLAT:		strcpy(str,"KM_NOTEXTUREFLAT");		break;
	case KM_NOTEXTUREGOURAUD:	strcpy(str,"KM_NOTEXTUREGOURAUD");	break;
	case KM_TEXTUREFLAT:		strcpy(str,"KM_TEXTUREFLAT");		break;
	case KM_TEXTUREGOURAUD:		strcpy(str,"KM_TEXTUREGOURAUD");	break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," ShadingMode        : %08Xh(%s)\n",pVertexContext->ShadingMode,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// SelectModifier ---------------------------------------------------------
	switch(pVertexContext->SelectModifier){
	case KM_NOMODIFIER:		strcpy(str,"KM_NOMODIFIER");	break;
	case KM_MODIFIER_A:		strcpy(str,"KM_MODIFIER_A");	break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," SelectModifier     : %08Xh(%s)\n",pVertexContext->SelectModifier,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// bZWriteDisable ---------------------------------------------------------
	switch(pVertexContext->bZWriteDisable){
	case TRUE:		strcpy(str,"TRUE");	break;
	case FALSE:		strcpy(str,"FALSE");	break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," bZWriteDisable     : %08Xh(%s)\n",pVertexContext->bZWriteDisable,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// SRCBlendingMode --------------------------------------------------------
	switch(pVertexContext->SRCBlendingMode){
	case KM_BOTHINVSRCALPHA:	strcpy(str,"KM_BOTHINVSRCALPHA");	break;
	case KM_BOTHSRCALPHA:		strcpy(str,"KM_BOTHSRCALPHA");		break;
	case KM_DESTALPHA:			strcpy(str,"KM_DESTALPHA");			break;
	case KM_DESTCOLOR:			strcpy(str,"KM_DESTCOLOR");			break;
	case KM_INVDESTALPHA:		strcpy(str,"KM_INVDESTALPHA");		break;
	case KM_INVDESTCOLOR:		strcpy(str,"KM_INVDESTCOLOR");		break;
	case KM_INVSRCALPHA:		strcpy(str,"KM_INVSRCALPHA");		break;
	case KM_INVSRCCOLOR:		strcpy(str,"KM_INVSRCCOLOR");		break;
	case KM_SRCALPHA:			strcpy(str,"KM_SRCALPHA");		break;
	case KM_SRCCOLOR:			strcpy(str,"KM_SRCCOLOR");		break;
	case KM_ONE:				strcpy(str,"KM_ONE");		break;
	case KM_ZERO:				strcpy(str,"KM_ZERO");		break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," SRCBlendingMode    : %08Xh(%s)\n",pVertexContext->SRCBlendingMode,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// DSTBlendingMode --------------------------------------------------------
	switch(pVertexContext->DSTBlendingMode){
	case KM_BOTHINVSRCALPHA:	strcpy(str,"KM_BOTHINVSRCALPHA");	break;
	case KM_BOTHSRCALPHA:		strcpy(str,"KM_BOTHSRCALPHA");		break;
	case KM_DESTALPHA:			strcpy(str,"KM_DESTALPHA");			break;
	case KM_DESTCOLOR:			strcpy(str,"KM_DESTCOLOR");			break;
	case KM_INVDESTALPHA:		strcpy(str,"KM_INVDESTALPHA");		break;
	case KM_INVDESTCOLOR:		strcpy(str,"KM_INVDESTCOLOR");		break;
	case KM_INVSRCALPHA:		strcpy(str,"KM_INVSRCALPHA");		break;
	case KM_INVSRCCOLOR:		strcpy(str,"KM_INVSRCCOLOR");		break;
	case KM_SRCALPHA:			strcpy(str,"KM_SRCALPHA");		break;
	case KM_SRCCOLOR:			strcpy(str,"KM_SRCCOLOR");		break;
	case KM_ONE:				strcpy(str,"KM_ONE");		break;
	case KM_ZERO:				strcpy(str,"KM_ZERO");		break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," DSTBlendingMode    : %08Xh(%s)\n",pVertexContext->DSTBlendingMode,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// bSRCSel --------------------------------------------------------
	switch(pVertexContext->bSRCSel){
	case TRUE:	strcpy(str,"TRUE");	break;
	case FALSE:	strcpy(str,"FALSE");		break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," bSRCSel            : %08Xh(%s)\n",pVertexContext->bSRCSel,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// bDSTSel --------------------------------------------------------
	switch(pVertexContext->bDSTSel){
	case TRUE:	strcpy(str,"TRUE");	break;
	case FALSE:	strcpy(str,"FALSE");		break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," bDSTSel            : %08Xh(%s)\n",pVertexContext->bDSTSel,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// FogMode --------------------------------------------------------
	switch(pVertexContext->FogMode){
	case KM_FOGTABLE:	strcpy(str,"KM_FOGTABLE");	break;
	case KM_FOGVERTEX:	strcpy(str,"KM_FOGVERTEX");	break;
	case KM_NOFOG:		strcpy(str,"KM_NOFOG");		break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," FogMode            : %08Xh(%s)\n",pVertexContext->FogMode,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// bUseSpecular ----------------------------------------------------
	switch(pVertexContext->bUseSpecular){
	case TRUE:	strcpy(str,"TRUE");	break;
	case FALSE:	strcpy(str,"FALSE");		break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," bUseSpecular       : %08Xh(%s)\n",pVertexContext->bUseSpecular,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// bUseAlpha ------------------------------------------------------
	switch(pVertexContext->bUseAlpha){
	case TRUE:	strcpy(str,"TRUE");	break;
	case FALSE:	strcpy(str,"FALSE");		break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," bUseAlpha          : %08Xh(%s)\n",pVertexContext->bUseAlpha,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// bIgnoreTextureAlpha --------------------------------------------
	switch(pVertexContext->bIgnoreTextureAlpha){
	case TRUE:	strcpy(str,"TRUE");	break;
	case FALSE:	strcpy(str,"FALSE");		break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," bIgnoreTextureAlpha: %08Xh(%s)\n",pVertexContext->bIgnoreTextureAlpha,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// FlipUV ---------------------------------------------------------
	switch(pVertexContext->FlipUV){
	case KM_NOFLIP:		strcpy(str,"KM_NOFLIP");	break;
	case KM_FLIP_V:		strcpy(str,"KM_FLIP_V");	break;
	case KM_FLIP_U:		strcpy(str,"KM_FLIP_U");	break;
	case KM_FLIP_UV:	strcpy(str,"KM_FLIP_UV");	break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," FlipUV             : %08Xh(%s)\n",pVertexContext->FlipUV,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// ClampUV ---------------------------------------------------------
	switch(pVertexContext->ClampUV){
	case KM_NOCLAMP:	strcpy(str,"KM_NOCLAMP");	break;
	case KM_CLAMP_V:	strcpy(str,"KM_CLAMP_V");	break;
	case KM_CLAMP_U:	strcpy(str,"KM_CLAMP_U");	break;
	case KM_CLAMP_UV:	strcpy(str,"KM_CLAMP_UV");	break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," ClampUV            : %08Xh(%s)\n",pVertexContext->ClampUV,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// FilterMode ------------------------------------------------------
	switch(pVertexContext->FilterMode){
	case KM_POINT_SAMPLE:	strcpy(str,"KM_POINT_SAMPLE");	break;
	case KM_BILINEAR:		strcpy(str,"KM_BILINEAR");		break;
//	case KM_TRILINEAR_A:	strcpy(str,"KM_TRILINEAR_A");	break;
//	case KM_TRILINEAR_B:	strcpy(str,"KM_TRILINEAR_B");	break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," FilterMode         : %08Xh(%s)\n",pVertexContext->FilterMode,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// bSuperSample ----------------------------------------------------
	switch(pVertexContext->bSuperSample){
	case TRUE:	strcpy(str,"TRUE");	break;
	case FALSE:	strcpy(str,"FALSE");		break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," bSuperSample       : %08Xh(%s)\n",pVertexContext->bSuperSample,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// MipMapAdjust ----------------------------------------------------
	bytes = sprintf(buff," MipMapAdjust       : %08Xh\n",pVertexContext->MipMapAdjust);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// TextureShadingMode ----------------------------------------------
	switch(pVertexContext->TextureShadingMode){
	case KM_MODULATE:		strcpy(str,"KM_MODULATE");			break;
	case KM_DECAL_ALPHA:	strcpy(str,"KM_DECAL_ALPHA");		break;
	case KM_MODULATE_ALPHA:	strcpy(str,"KM_MODULATE_ALPHA");	break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," TextureShadingMode : %08Xh(%s)\n",pVertexContext->TextureShadingMode,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// bColorClamp -----------------------------------------------------
	switch(pVertexContext->bColorClamp){
	case TRUE:	strcpy(str,"TRUE");	break;
	case FALSE:	strcpy(str,"FALSE");		break;
	default: strcpy(str,"???UNDEFINED???");	break;
	}
	bytes = sprintf(buff," bColorClamp        : %08Xh(%s)\n",pVertexContext->bColorClamp,str);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// PaletteBank ----------------------------------------------------
	bytes = sprintf(buff," PaletteBank        : %08Xh\n",pVertexContext->PaletteBank);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// pTextureSurfaceDesc --------------------------------------------
	bytes = sprintf(buff," pTextureSurfaceDesc: %08Xh\n",pVertexContext->pTextureSurfaceDesc);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	// Params --------------------------------------------
	bytes = sprintf(buff," GLOBALPARAMBUFFER  : %08Xh\n",pVertexContext->GLOBALPARAMBUFFER);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	bytes = sprintf(buff," ISPPARAMBUFFER     : %08Xh\n",pVertexContext->ISPPARAMBUFFER);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	bytes = sprintf(buff," TSPPARAMBUFFER     : %08Xh\n",pVertexContext->TSPPARAMBUFFER);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	bytes = sprintf(buff," TexturePARAMBUFFER : %08Xh\n",pVertexContext->TexturePARAMBUFFER);	fResult = WriteFile( hFile, buff, (DWORD)bytes, &nWrited, NULL);
	/* ファイルのクローズ ***************************************************************/
	CloseHandle(hFile);							/* ファイルクローズ */
}
