--- spal60sr\src\TSSGCtrl\SSBundleFloatCalc.original.cpp	Sun Apr  6 21:44:04 2003
+++ spal60sr\src\TSSGCtrl\SSBundleFloatCalc.cpp	Sun Apr  6 21:44:04 2003
@@ -1,5 +1,13 @@
 #include "SSBundleFloatCalc.h"
 #include "BitOperation.h"
+
+#define LOCAL_MEMORY_SUPPORT 1
+
+#if defined(LOCAL_MEMORY_SUPPORT) && LOCAL_MEMORY_SUPPORT
+unsigned long __stdcall TSSGCtrl_Read_with_CheckLocalMemory(TSSGCtrl *_this, TSSGSubject *SSGS, HANDLE ProcessHandle, DWORD *Address, vector<TProcessAccessElementBase*> &AEVec, const string &AddressStr);
+BOOLEAN __stdcall TSSGCtrl_OneWrite_with_CheckLocalMemory(TSSGCtrl *_this, TSSGSubject *SSGS, HANDLE ProcessHandle, DWORD Address, LPVOID Data, DWORD Size, const string &AddressStr);
+#endif
+
 //---------------------------------------------------------------------
 //uݒ֐v
 //
@@ -61,14 +69,26 @@
  Setting(SSGC);
  
  TSmartHandle SHandle;
+#if !defined(LOCAL_MEMORY_SUPPORT) || !LOCAL_MEMORY_SUPPORT
  if(( SHandle=SSGC.Open(this, PROCESS_VM_READ) )==NULL)
 	return ssgCtrl::reOPEN_ERROR;	//vZX̃I[vG[
+#else
+ SHandle = SSGC.Open(this, PROCESS_VM_READ);
+#endif
 
+#if !defined(SUBJECT_STATUS) || !SUBJECT_STATUS
  if(!SSGC.IsEnabled(this)) return ssgCtrl::reNOT_ENABLED;	//LU
+#else
+ if(!SSGC.IsEnabled(this, TRUE)) return ssgCtrl::reNOT_ENABLED;	//LU
+#endif
 
 
  //ItZbgp̃AhXɂ́A[replace]̑tȂ
+#if !defined(SUBJECT_STATUS) || !SUBJECT_STATUS
  unsigned long Address = (isOffset)?SSGC.GetAddress(this, addressStr, 0):0;
+#else
+ unsigned long Address = (isOffset) ? (unsigned long)(address = (const BYTE *)SSGC.GetAddress(this, addressStr, 0)) : 0;
+#endif
 
  if(size==0)	//Setting()ł̓t@CJȂ
 	return ssgCtrl::reOPTION_ERROR;	//Xgt@CȂI
@@ -91,9 +111,16 @@
 	for(; VIt!=VEnd; VIt++){
 		if(VIt->empty()) continue;
 	
+#if !defined(LOCAL_MEMORY_SUPPORT) || !LOCAL_MEMORY_SUPPORT
 		ThisAddress = Address+SSGC.GetAddress(this, SSGC.strD.Get(*VIt,",",0));
 
 		if(SSGC.Read(this, SHandle, &ThisAddress, AEVec)!=0) 
+#else
+		string addressStr(SSGC.strD.Get(*VIt, ",", 0));
+		ThisAddress = Address + SSGC.GetAddress(this, addressStr);
+
+		if (TSSGCtrl_Read_with_CheckLocalMemory(&SSGC, this, SHandle, &ThisAddress, AEVec, addressStr) != 0)
+#endif
 			return ssgCtrl::reACCESS_ERROR;	//G[Ȃ1Ԃ
 		memcpy(&Val, AE.GetData()->begin(), size );
 
@@ -132,14 +159,22 @@
  Setting(SSGC);
 
  TSmartHandle SHandle;
+#if !defined(LOCAL_MEMORY_SUPPORT) || !LOCAL_MEMORY_SUPPORT
  if(( SHandle=SSGC.Open(this, PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_VM_OPERATION) )==NULL)
 	return ssgCtrl::reOPEN_ERROR;	//vZX̃I[vG[
+#else
+ SHandle = SSGC.Open(this, PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_VM_OPERATION);
+#endif
 
  if(!SSGC.IsEnabled(this)) return ssgCtrl::reNOT_ENABLED;	//LU
 
 
  //ItZbgp̃AhXɂ́A[replace]̑tȂ
+#if !defined(SUBJECT_STATUS) || !SUBJECT_STATUS
  unsigned long Address = (isOffset)?SSGC.GetAddress(this, addressStr, 0):0;
+#else
+ unsigned long Address = (isOffset) ? (unsigned long)(address = (const BYTE *)SSGC.GetAddress(this, addressStr, 0)) : 0;
+#endif
 
  vector<string> *ListFile = SSGC.GetSSGDataFile(this, fileName, ".CHN");
  if(ListFile==NULL) return ssgCtrl::reOPTION_ERROR;	//`FCt@CȂI
@@ -159,9 +194,16 @@
 		for(; VIt!=VEnd; VIt++){
 			if(VIt->empty()) continue;
 
+#if !defined(LOCAL_MEMORY_SUPPORT) || !LOCAL_MEMORY_SUPPORT
 			ThisAddress = Address+SSGC.GetAddress(this, SSGC.strD.Get(*VIt,",",0));
 
 			if( !SSGC.OneWrite(this, SHandle, ThisAddress, &Val2, size) ){
+#else
+			string addressStr(SSGC.strD.Get(*VIt, ",", 0));
+			ThisAddress = Address + SSGC.GetAddress(this, addressStr);
+
+			if (!TSSGCtrl_OneWrite_with_CheckLocalMemory(&SSGC, this, SHandle, ThisAddress, &Val2, size, addressStr)) {
+#endif
 				//G[ȂssgCtrl::reACCESS_ERRORԂ
 				return ssgCtrl::reACCESS_ERROR;
 			}
@@ -173,8 +215,14 @@
 		for(; VIt!=VEnd; VIt++){
 			if(VIt->empty()) continue;
 
+#if !defined(LOCAL_MEMORY_SUPPORT) || !LOCAL_MEMORY_SUPPORT
 			ThisAddress = Address+SSGC.GetAddress(this, SSGC.strD.Get(*VIt,",",0));
 			if( !SSGC.OneWrite(this, SHandle, ThisAddress, &Val2, size) ){
+#else
+			string addressStr(SSGC.strD.Get(*VIt, ",", 0));
+			ThisAddress = Address + SSGC.GetAddress(this, addressStr);
+			if (!TSSGCtrl_OneWrite_with_CheckLocalMemory(&SSGC, this, SHandle, ThisAddress, &Val2, size, addressStr)) {
+#endif
 				//G[ȂssgCtrl::reACCESS_ERRORԂ
 				return ssgCtrl::reACCESS_ERROR;
 			}
