Add rayman2 source files
This commit is contained in:
96
Rayman_X/cpa/tempgrp/sndext/win95/ACP/SndacpV.dsp
Normal file
96
Rayman_X/cpa/tempgrp/sndext/win95/ACP/SndacpV.dsp
Normal file
@@ -0,0 +1,96 @@
|
||||
# Microsoft Developer Studio Project File - Name="SNDacpV" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 5.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=SNDacpV - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "SndacpV.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "SndacpV.mak" CFG="SNDacpV - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "SNDacpV - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "SNDacpV - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP Scc_ProjName ""$/cpa/tempgrp/sndext/win95/ACP", FQNAAAAA"
|
||||
# PROP Scc_LocalPath "."
|
||||
CPP=clbis.exe
|
||||
|
||||
!IF "$(CFG)" == "SNDacpV - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W4 /GX /O2 /I "x:\cpa\public" /I "x:\cpa\tempgrp\snd\inc\win95" /I "x:\cpa\tempgrp\snd\inc" /D "NDEBUG" /D "VISUAL" /D "CPA_WANTS_EXPORT" /D "WIN32" /D "_WINDOWS" /D "MEM_USE_ACP" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=linkbis.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"x:\cpa\lib\SNDacpVr.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SNDacpV - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W4 /GX /Z7 /Od /I "x:\cpa\public" /I "x:\cpa\tempgrp\snd\inc\win95" /I "x:\cpa\tempgrp\snd\inc" /D "_DEBUG" /D "VISUAL" /D "CPA_WANTS_EXPORT" /D "WIN32" /D "_WINDOWS" /FR /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=linkbis.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"x:\cpa\lib\SNDacpVd.lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "SNDacpV - Win32 Release"
|
||||
# Name "SNDacpV - Win32 Debug"
|
||||
# Begin Group "Sources Files"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Snderr.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sndmem.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\SndacpV.mak
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
167
Rayman_X/cpa/tempgrp/sndext/win95/ACP/SndacpV.vcproj
Normal file
167
Rayman_X/cpa/tempgrp/sndext/win95/ACP/SndacpV.vcproj
Normal file
@@ -0,0 +1,167 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="SNDacpV"
|
||||
ProjectGUID="{48DC8420-2880-487A-A653-ED704CBC505D}"
|
||||
SccProjectName=""$/cpa/tempgrp/sndext/win95/ACP", FQNAAAAA"
|
||||
SccAuxPath=""
|
||||
SccLocalPath="."
|
||||
SccProvider="MSSCCI:NXN alienbrain">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="x:\cpa\libd"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="x:\cpa\public,x:\cpa\tempgrp\snd\inc\win95,x:\cpa\tempgrp\snd\inc"
|
||||
PreprocessorDefinitions="_DEBUG;VISUAL;CPA_WANTS_EXPORT;WIN32;_WINDOWS"
|
||||
RuntimeLibrary="3"
|
||||
PrecompiledHeaderFile=".\Debug/SndacpV.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="4"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="1"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="x:\cpa\libd\SNDacpVd.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="x:\cpa\public,x:\cpa\tempgrp\snd\inc\win95,x:\cpa\tempgrp\snd\inc"
|
||||
PreprocessorDefinitions="NDEBUG;VISUAL;CPA_WANTS_EXPORT;WIN32;_WINDOWS;MEM_USE_ACP"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
PrecompiledHeaderFile=".\Release/SndacpV.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="4"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="x:\cpa\lib\SNDacpVr.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Sources Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath="Snderr.c">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="sndmem.c">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="SndacpV.mak">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
458
Rayman_X/cpa/tempgrp/sndext/win95/ACP/Snderr.c
Normal file
458
Rayman_X/cpa/tempgrp/sndext/win95/ACP/Snderr.c
Normal file
@@ -0,0 +1,458 @@
|
||||
/*
|
||||
//////////////////////////////////////////////////////////////
|
||||
// SNDERR.CXX - SOUNDxD Version 2.0
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Error managing functions.
|
||||
/////////////////////////////////////////////////////////////
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
#include "SND\snddef.h"
|
||||
|
||||
#include "SND/snderr.h"
|
||||
|
||||
#define __DeclareGlobalVariableErrSnd_h__
|
||||
#include "SNDext/errsnd.h"
|
||||
|
||||
//<2F>tablir le niveau maxi des Warnings
|
||||
#ifdef DEBUG_SON
|
||||
#define SNDERR_MAX_DISPLAYED_ERROR E_uwSndErrNumber
|
||||
#else
|
||||
#define SNDERR_MAX_DISPLAYED_ERROR E_uwSndEndOfWarningLevel2
|
||||
#endif
|
||||
|
||||
//#include "sndmusct.h"
|
||||
#include "sndwin95.h"
|
||||
#include "sndthrd.h"
|
||||
|
||||
#ifndef SNDERR_USE_ACP
|
||||
#define NB_ERROR_MAX 5
|
||||
int g_iNbError=0;
|
||||
struct {
|
||||
unsigned long ulChannel;
|
||||
unsigned short uwErr;
|
||||
} astErrDescriptor[NB_ERROR_MAX];
|
||||
#endif
|
||||
|
||||
typedef struct _tdstSndErrorOccurElement
|
||||
{
|
||||
SndBool bOccured;
|
||||
SndBool bDontDisplay;
|
||||
SndBool bDONTAskToBeDisplayed;
|
||||
} tdstSndErrorOccurElement;
|
||||
tdstSndErrorOccurElement SND_g_astErrorOccurArray[E_uwSndErrNumber];
|
||||
|
||||
HWND SNDERR_g_hwndMainWnd=NULL;
|
||||
|
||||
#ifdef DEBUG_SON
|
||||
void liste_of_association(char *texte,long size);
|
||||
void liste_of_voices(char* texte,long size);
|
||||
|
||||
//returns TRUE if errors yet occured in the past
|
||||
SndBool fn_bHasErrorOccured(unsigned short uwErrNum)
|
||||
{
|
||||
snd_assert(uwErrNum>0);snd_assert(uwErrNum<E_uwSndErrNumber);
|
||||
|
||||
return SND_g_astErrorOccurArray[uwErrNum].bOccured;
|
||||
}
|
||||
|
||||
void fn_vSetErrorOccured(unsigned short uwErrNum)
|
||||
{
|
||||
snd_assert(uwErrNum>0);snd_assert(uwErrNum<E_uwSndErrNumber);
|
||||
|
||||
SND_g_astErrorOccurArray[uwErrNum].bOccured=TRUE;
|
||||
}
|
||||
|
||||
SndBool fn_bErrorToBeDisplayed(unsigned short uwErrNum)
|
||||
{
|
||||
snd_assert(uwErrNum>0);snd_assert(uwErrNum<E_uwSndErrNumber);
|
||||
|
||||
return !SND_g_astErrorOccurArray[uwErrNum].bDontDisplay;
|
||||
}
|
||||
|
||||
void fn_vSetErrorToNOTBeDisplayed(unsigned short uwErrNum)
|
||||
{
|
||||
snd_assert(uwErrNum>0);snd_assert(uwErrNum<E_uwSndErrNumber);
|
||||
|
||||
SND_g_astErrorOccurArray[uwErrNum].bDontDisplay=TRUE;
|
||||
}
|
||||
|
||||
SndBool fn_bErrorDONTAskToBeDisplayed(unsigned short uwErrNum)
|
||||
{
|
||||
snd_assert(uwErrNum>0);snd_assert(uwErrNum<E_uwSndErrNumber);
|
||||
|
||||
return SND_g_astErrorOccurArray[uwErrNum].bDONTAskToBeDisplayed;
|
||||
}
|
||||
|
||||
void fn_vSetErrorDONTAskToBeDisplayed(unsigned short uwErrNum)
|
||||
{
|
||||
snd_assert(uwErrNum>0);snd_assert(uwErrNum<E_uwSndErrNumber);
|
||||
|
||||
SND_g_astErrorOccurArray[uwErrNum].bDONTAskToBeDisplayed=TRUE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// Rapport complet pour d<>boguage
|
||||
//--------------------------------------------------------------
|
||||
/*
|
||||
void SND_fn_vDebuggingReport()
|
||||
{
|
||||
char blabla[256]="";
|
||||
char lst_evt[10000]="";
|
||||
char lst_rsv[10000]="";
|
||||
char file_name[256]="";
|
||||
WIN32_FIND_DATA FindFileData;
|
||||
HANDLE handle;
|
||||
BOOL idOK;
|
||||
int id;
|
||||
SYSTEMTIME time;
|
||||
DWORD nb;
|
||||
|
||||
//liste des events
|
||||
liste_of_association(lst_evt,sizeof(lst_evt));
|
||||
//liste des ressources
|
||||
liste_of_voices(lst_rsv,sizeof(lst_rsv));
|
||||
|
||||
//recherche du nom de fichier dispo
|
||||
id=0;idOK=FALSE;
|
||||
while (!idOK && (id<1000))
|
||||
{
|
||||
sprintf(file_name,"SNDdbg%d.txt",id);
|
||||
memset(&FindFileData,0,sizeof(FindFileData));
|
||||
if ((handle=FindFirstFile(file_name,&FindFileData))==INVALID_HANDLE_VALUE)
|
||||
idOK=TRUE;
|
||||
else
|
||||
{
|
||||
id++;
|
||||
FindClose(handle);
|
||||
}
|
||||
}
|
||||
if (!idOK) id=0;
|
||||
|
||||
//cr<63>ation du fichier de report
|
||||
handle=CreateFile(file_name,GENERIC_WRITE,0,NULL,CREATE_NEW,0,NULL);
|
||||
GetLocalTime(&time);
|
||||
sprintf(blabla,"Report file created %d:%d:%d on %d %d %d\n\n",time.wHour,time.wMinute,time.wSecond
|
||||
,time.wDay,time.wMonth,time.wYear);
|
||||
WriteFile(handle,blabla,strlen(blabla),&nb,NULL);
|
||||
sprintf(blabla,"\nEVENTS LIST***************************\n");
|
||||
WriteFile(handle,blabla,strlen(blabla),&nb,NULL);
|
||||
WriteFile(handle,lst_evt,strlen(lst_evt),&nb,NULL);
|
||||
sprintf(blabla,"\nVOICES LIST***************************\n");
|
||||
WriteFile(handle,blabla,strlen(blabla),&nb,NULL);
|
||||
WriteFile(handle,lst_rsv,strlen(lst_rsv),&nb,NULL);
|
||||
sprintf(blabla,"\nEND***************************\n");
|
||||
WriteFile(handle,blabla,strlen(blabla),&nb,NULL);
|
||||
CloseHandle(handle);
|
||||
}*/
|
||||
#else
|
||||
/*
|
||||
void SND_fn_vDebuggingReport()
|
||||
{
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// DisplayError : display an error message
|
||||
// Entr<74>e: id de l'erreur
|
||||
// Sortie: n<>ant
|
||||
//--------------------------------------------------------------
|
||||
void SND_CALL SND_fn_vDisplayError(unsigned short uwErrNum,char *message)
|
||||
{
|
||||
/*
|
||||
char texte[256];
|
||||
|
||||
sprintf(texte,"%d : %s",uwErrNum,message);
|
||||
MessageBox(SNDERR_g_hwndMainWnd,texte,"Erreur SND hyper-importante !!!",MB_OK);
|
||||
*/
|
||||
SND_fn_vEnterCriticalSectionForErrorDisplay();
|
||||
|
||||
SND_M_UpdateLastError((unsigned long)GetCurrentThreadId(),uwErrNum, C_lErmNoDebugData,C_ucErmOpenInfoWindow,C_ucAllowStopForDebug,message);
|
||||
SND_M_CheckError((unsigned long)GetCurrentThreadId());
|
||||
SND_M_ClearLastError((unsigned long)GetCurrentThreadId());
|
||||
|
||||
SND_fn_vQuitCriticalSectionForErrorDisplay();
|
||||
}
|
||||
|
||||
void SND_CALL SND_fn_vDisplayErrorEx(unsigned short uwErrNum,char *message,int flags)
|
||||
{
|
||||
#ifdef DEBUG_SON
|
||||
int ret;
|
||||
|
||||
SND_fn_vEnterCriticalSectionForErrorDisplay();
|
||||
|
||||
if ((flags==SNDERR_DISPLAY_ALLWAYS)
|
||||
|| ((flags==SNDERR_DISPLAY_ONLY_ONCE) && !fn_bHasErrorOccured(uwErrNum))
|
||||
|| ((flags==SNDERR_DISPLAY_IF_WANTED) && fn_bErrorToBeDisplayed(uwErrNum)))
|
||||
{
|
||||
SND_M_UpdateLastError((unsigned long)GetCurrentThreadId(),uwErrNum, C_lErmNoDebugData,C_ucErmOpenInfoWindow,C_ucAllowStopForDebug,message);
|
||||
SND_M_CheckError((unsigned long)GetCurrentThreadId());
|
||||
fn_vSetErrorOccured(uwErrNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
SND_M_UpdateLastError((unsigned long)GetCurrentThreadId(),uwErrNum, C_lErmNoDebugData,0,0,message);
|
||||
SND_M_CheckError((unsigned long)GetCurrentThreadId());
|
||||
}
|
||||
|
||||
//"May error be displayed next time?"
|
||||
if ((flags==SNDERR_DISPLAY_IF_WANTED) && fn_bErrorToBeDisplayed(uwErrNum) && !fn_bErrorDONTAskToBeDisplayed(uwErrNum))
|
||||
{
|
||||
ret=Erm_fn_iMessageBox(
|
||||
"Do you want this error to be displayed next time ?\nCancel=don't ask this question any more"
|
||||
,"This error may occur many time from now !"
|
||||
,MB_YESNOCANCEL);
|
||||
if (ret==IDNO)
|
||||
fn_vSetErrorToNOTBeDisplayed(uwErrNum);
|
||||
else
|
||||
if (ret==IDCANCEL)
|
||||
fn_vSetErrorDONTAskToBeDisplayed(uwErrNum);
|
||||
}
|
||||
|
||||
SND_M_ClearLastError((unsigned long)GetCurrentThreadId());
|
||||
|
||||
SND_fn_vQuitCriticalSectionForErrorDisplay();
|
||||
#else
|
||||
SND_fn_vDisplayError(uwErrNum,message);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SNDERR_USE_ACP
|
||||
void SND_CALL SND_fn_vInitErrorSnd(SND_tdstInitStruct *pInitStruct)
|
||||
{
|
||||
SNDERR_g_hwndMainWnd=pInitStruct->hMainWindow;
|
||||
|
||||
Erm_M_InitErrMsg(Snd);
|
||||
memset(&SND_g_astErrorOccurArray,0,sizeof(SND_g_astErrorOccurArray));
|
||||
}
|
||||
|
||||
void SND_CALL SND_fn_vDesInitErrorSnd(void)
|
||||
{
|
||||
}
|
||||
|
||||
void SND_fn_vUpdateLastError(unsigned long ulChannelId,
|
||||
unsigned short uwErrNum,
|
||||
long lDebugData,
|
||||
unsigned char ucOpenInfoWindow,
|
||||
unsigned char ucStopForDebug,
|
||||
char* message)
|
||||
{
|
||||
if (uwErrNum>SNDERR_MAX_DISPLAYED_ERROR)
|
||||
{
|
||||
Erm_M_UpdateLastError(Snd, ulChannelId, uwErrNum, lDebugData, 0, 0,message);
|
||||
}
|
||||
else
|
||||
{
|
||||
Erm_M_UpdateLastError(Snd, ulChannelId, uwErrNum, lDebugData, ucOpenInfoWindow, ucStopForDebug,message);
|
||||
}
|
||||
}
|
||||
#else // SNDERR_USE_ACP
|
||||
|
||||
//non using ERM module
|
||||
void SND_CALL SND_fn_vInitErrorSnd(SND_tdstInitStruct *pInitStruct)
|
||||
{
|
||||
SNDERR_g_hwndMainWnd=pInitStruct->hMainWindow;
|
||||
}
|
||||
|
||||
void SND_CALL SND_fn_vDesInitErrorSnd(void)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// UpdateLastError : display and save an error message
|
||||
// Entr<74>e:ulChannelId=channel of error occurence (up to NB_ERROR_MAX)
|
||||
// uwErrNum=error id
|
||||
// lDebugData,ucOpenInfoWindow,ucStopForDebug=not used
|
||||
// Sortie: n<>ant
|
||||
//--------------------------------------------------------------
|
||||
void SND_fn_vUpdateLastError(unsigned long ulChannelId,
|
||||
unsigned short uwErrNum,
|
||||
long lDebugData,
|
||||
unsigned char ucOpenInfoWindow,
|
||||
unsigned char ucStopForDebug,
|
||||
char* message)
|
||||
{
|
||||
int i;
|
||||
char texte[128];
|
||||
|
||||
i=0;
|
||||
while ((g_a_stSndTabErr[i].uwErrorId!=uwErrNum) && (g_a_stSndTabErr[i].uwErrorId!=0xFFFF))
|
||||
i++;
|
||||
|
||||
//--affichage
|
||||
if (g_a_stSndTabErr[i].uwErrorId==0xFFFF)
|
||||
sprintf(texte,"Unknown error #%d",uwErrNum);
|
||||
else
|
||||
sprintf(texte,"%s",g_a_stSndTabErr[i].szErrorText);
|
||||
if (message!=NULL) strncat(texte,message,sizeof(texte)-strlen(texte)-1);
|
||||
|
||||
MessageBox(SNDERR_g_hwndMainWnd,texte,"Sound Error",MB_OK|MB_TOPMOST);
|
||||
|
||||
//---stockage de l'erreur
|
||||
i=0;
|
||||
while ((i<g_iNbError) && (astErrDescriptor[i].ulChannel!=ulChannelId)) i++;
|
||||
if (i<g_iNbError)
|
||||
{
|
||||
sprintf(texte,"Channel %d is still busy !!",i);
|
||||
MessageBox(SNDERR_g_hwndMainWnd,texte,"Sound Error anomaly",MB_OK|MB_TOPMOST);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_iNbError<NB_ERROR_MAX)
|
||||
{
|
||||
astErrDescriptor[g_iNbError].ulChannel=ulChannelId;
|
||||
astErrDescriptor[g_iNbError++].uwErr=uwErrNum;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(texte,"Too many channel busy !!");
|
||||
MessageBox(SNDERR_g_hwndMainWnd,texte,"Sound Error anomaly",MB_OK|MB_TOPMOST);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (MessageBox(SNDERR_g_hwndMainWnd,"","Do you want to debug ?",MB_YESNO)==IDYES)
|
||||
DebugBreak();
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
// ClearLastError: clear last error raised on channel ulChannelID
|
||||
//--------------------------------------------------------
|
||||
void SND_fn_vClearLastError(unsigned long ulChannelId)
|
||||
{
|
||||
int i;
|
||||
|
||||
i=0;
|
||||
while ((astErrDescriptor[i].ulChannel!=ulChannelId) && (i<g_iNbError)) i++;
|
||||
if (i<g_iNbError)
|
||||
{
|
||||
astErrDescriptor[i].ulChannel=astErrDescriptor[g_iNbError].ulChannel;
|
||||
astErrDescriptor[i].uwErr=astErrDescriptor[g_iNbError--].uwErr;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// CheckError:returns last error raised on ulChannelID
|
||||
//-------------------------------------------------------------
|
||||
unsigned short SND_fn_vCheckError(unsigned long ulChannelId)
|
||||
{
|
||||
int i;
|
||||
|
||||
i=0;
|
||||
while ((astErrDescriptor[i].ulChannel!=ulChannelId) && (i<g_iNbError)) i++;
|
||||
if (i<g_iNbError)
|
||||
return astErrDescriptor[i].uwErr;
|
||||
else
|
||||
return 0xFFFF;
|
||||
}
|
||||
#endif
|
||||
|
||||
//----- this part is not ACP complient
|
||||
void SND_CALL _snd_assert(char* test,char* file,int line)
|
||||
{
|
||||
char titre[256];
|
||||
char texte[256];
|
||||
|
||||
// Assertion Failed in SND !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
DebugBreak();
|
||||
// Assertion Failed in SND !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
strcpy(titre,"Sound-Assertion failed in ");
|
||||
strcat(titre,file);
|
||||
sprintf(texte," (Line n<> %d)",line);
|
||||
strcat(titre,texte);
|
||||
|
||||
SND_fn_vEnterCriticalSectionForErrorDisplay();
|
||||
|
||||
MessageBox(SNDERR_g_hwndMainWnd,test,titre,MB_OK|MB_TOPMOST);
|
||||
|
||||
SND_fn_vQuitCriticalSectionForErrorDisplay();
|
||||
|
||||
DebugBreak();
|
||||
}
|
||||
|
||||
/*************************************************************************************
|
||||
traitement des erreurs d'init de driver
|
||||
*************************************************************************************/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
Traitement de l'<27>chec de l'init
|
||||
Entr<74>e:num_err=indice de l'erreur
|
||||
Sortie:INIT_RETRY pour r<>essayer
|
||||
INIT_CONTINUE pour continuer malgr<67> tout
|
||||
INIT_FAILED pour abandon
|
||||
--------------------------------------------------------------------------*/
|
||||
int SND_CALL snd_erreur_init(int num_err)
|
||||
{
|
||||
int ret,code;
|
||||
|
||||
SND_fn_vEnterCriticalSectionForErrorDisplay();
|
||||
|
||||
ret=Erm_fn_iMessageBox("To continue with sound, close the application that is using the sound driver, and select Retry.\nTo continue without sound, select Cancel."
|
||||
,"Sound-Driver is busy"
|
||||
,MB_RETRYCANCEL |MB_TOPMOST);
|
||||
switch (ret)
|
||||
{
|
||||
case IDABORT:
|
||||
code=INIT_FAILED;
|
||||
break;
|
||||
case IDIGNORE:
|
||||
case IDCANCEL:
|
||||
code=INIT_IGNORE;
|
||||
break;
|
||||
case IDRETRY:
|
||||
code=INIT_RETRY;
|
||||
break;
|
||||
default:
|
||||
code=INIT_IGNORE;
|
||||
break;
|
||||
}
|
||||
|
||||
SND_fn_vQuitCriticalSectionForErrorDisplay();
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// SND_fn_iErreurInit
|
||||
//
|
||||
// But : Initialisation de la fenetre de dialogue
|
||||
// des erreurs a l'init du driver CD
|
||||
// Entr<74>es : constantes numero d'erreur
|
||||
// Sorties : code de retour de la boite de dialogue
|
||||
//------------------------------------------------------------
|
||||
int SND_CALL SND_fn_iErreurInit(int num_err)
|
||||
{
|
||||
int ret,code;
|
||||
|
||||
SND_fn_vEnterCriticalSectionForErrorDisplay();
|
||||
|
||||
ret=Erm_fn_iMessageBox("Insert a CD or\nClose the application using your CD and try again ...\nelse you'll not be able to hear any music"
|
||||
,"CD-Driver Problem"
|
||||
,MB_RETRYCANCEL |MB_TOPMOST);
|
||||
switch (ret)
|
||||
{
|
||||
case IDABORT:
|
||||
code=INIT_FAILED;
|
||||
break;
|
||||
case IDIGNORE:
|
||||
case IDCANCEL:
|
||||
code=INIT_IGNORE;
|
||||
break;
|
||||
case IDRETRY:
|
||||
code=INIT_RETRY;
|
||||
break;
|
||||
default:
|
||||
code=INIT_IGNORE;
|
||||
break;
|
||||
}
|
||||
|
||||
SND_fn_vQuitCriticalSectionForErrorDisplay();
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
5
Rayman_X/cpa/tempgrp/sndext/win95/ACP/mssccprj.scc
Normal file
5
Rayman_X/cpa/tempgrp/sndext/win95/ACP/mssccprj.scc
Normal file
@@ -0,0 +1,5 @@
|
||||
SCC = This is a source code control file
|
||||
|
||||
[SndacpV.vcproj]
|
||||
SCC_Aux_Path = "P4SCC#srvperforce-ma:1666##raymandata##Editor"
|
||||
SCC_Project_Name = Perforce Project
|
668
Rayman_X/cpa/tempgrp/sndext/win95/ACP/sndmem.c
Normal file
668
Rayman_X/cpa/tempgrp/sndext/win95/ACP/sndmem.c
Normal file
@@ -0,0 +1,668 @@
|
||||
/*
|
||||
//////////////////////////////////////////////////////////////
|
||||
// SNDMEM.CXX - SOUNDxD Version 2.0
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Memory managing functions.
|
||||
/////////////////////////////////////////////////////////////
|
||||
*/
|
||||
|
||||
#include "SND/snddef.h"
|
||||
|
||||
#include "MMG.h"
|
||||
|
||||
#include "SND/sndmem.h"
|
||||
#include "SND/snderr.h"
|
||||
|
||||
#ifndef NO_ACP_MEMORY
|
||||
#define __DeclareGlobalVariableMmgSnd_h__
|
||||
#include "SNDext/mmgsnd.h"
|
||||
#include "SNDext/errsnd.h"
|
||||
#endif //NO_ACP_MEMORY
|
||||
|
||||
#include "sndthrd.h"
|
||||
|
||||
typedef struct tdstBlockInfoPriv_{
|
||||
char * p_cBeginBlock;
|
||||
char * p_cEndBlock;
|
||||
char * p_cFirstFree;
|
||||
char * p_cMaxMem;
|
||||
}tdstBlockInfoPriv;
|
||||
|
||||
#ifdef MEMORY_ACCES_MANAGEMENT_MODE
|
||||
void SND_fn_vInitMemoryAccessManagement();
|
||||
void SND_fn_vDesInitMemoryAccessManagement();
|
||||
LPTOP_LEVEL_EXCEPTION_FILTER g_pfnPrevExceptionHandler;
|
||||
#endif
|
||||
|
||||
void SND_fn_vCheckMemory()
|
||||
{
|
||||
#if defined(DEBUG) || !defined(NDEBUG)
|
||||
unsigned char ucBlockId;
|
||||
unsigned long ulNbMalloc;
|
||||
unsigned long ulNbFree;
|
||||
tdstBlockInfoPriv *p_stMyBlockInfo;
|
||||
unitAlloc * p_uaPtr;
|
||||
unitAlloc * p_uaFreePtr;
|
||||
unitAlloc uaTotalAllocatedSize;
|
||||
unitAlloc uaTotalFreeSize;
|
||||
unitAlloc uaRemainSpace;
|
||||
unitAlloc uaBlockSize;
|
||||
unitAlloc uaMaxUsed;
|
||||
struct tdstBlockInfoPriv_ * a_stMyBlockInfo=g_a_p_stMmgModuleBlocksInfo[g_ucSndModuleId];
|
||||
unsigned char ucModuleMaxBlocksNb=E_ucSndMaxBlocksNb;
|
||||
|
||||
Mmg_MEnterCriticalSection();
|
||||
|
||||
//for (ucBlockId=0; ucBlockId<ucModuleMaxBlocksNb; ucBlockId++)
|
||||
//due to misalignement between MMG and SND, only first block is etstable
|
||||
{
|
||||
ucBlockId=0;
|
||||
p_stMyBlockInfo = a_stMyBlockInfo + ucBlockId;
|
||||
|
||||
p_uaPtr=(unitAlloc *)p_stMyBlockInfo->p_cBeginBlock;
|
||||
p_uaFreePtr = (unitAlloc *)p_stMyBlockInfo->p_cFirstFree;
|
||||
uaTotalAllocatedSize = 0;
|
||||
uaTotalFreeSize = 0;
|
||||
ulNbFree = 0;
|
||||
ulNbMalloc =0;
|
||||
while (p_uaPtr < (unitAlloc *)p_stMyBlockInfo->p_cEndBlock){// scan all malloc
|
||||
if (p_uaFreePtr == p_uaPtr){// it's a free
|
||||
if (((unitAlloc *) *(p_uaFreePtr+1)) != (unitAlloc *) 0){
|
||||
// not the last free
|
||||
p_uaFreePtr = (unitAlloc *) *(p_uaFreePtr+1); // go to the next free
|
||||
ulNbFree++;
|
||||
uaTotalFreeSize += *p_uaPtr;
|
||||
}
|
||||
}
|
||||
else{// this is a malloc
|
||||
uaTotalAllocatedSize += *p_uaPtr;
|
||||
ulNbMalloc++;
|
||||
}
|
||||
if (*(p_uaPtr)==0)
|
||||
{
|
||||
DebugBreak();
|
||||
}
|
||||
p_uaPtr += *(p_uaPtr);
|
||||
}//end of while
|
||||
|
||||
if ((p_uaPtr != (unitAlloc *)(p_stMyBlockInfo->p_cEndBlock + 1)) && (uaTotalAllocatedSize)){
|
||||
snd_assert(FALSE);
|
||||
}
|
||||
else {
|
||||
uaBlockSize = p_stMyBlockInfo->p_cEndBlock - p_stMyBlockInfo->p_cBeginBlock +1;
|
||||
uaMaxUsed = p_stMyBlockInfo->p_cMaxMem - p_stMyBlockInfo->p_cBeginBlock +1;
|
||||
if ( (unitAlloc *) (p_uaFreePtr) == (unitAlloc *) NULL){
|
||||
//all the space is used !!
|
||||
uaRemainSpace = 0;
|
||||
}
|
||||
else {
|
||||
uaRemainSpace = ((*p_uaFreePtr)<<C_uwShiftAllocSize);
|
||||
}
|
||||
|
||||
uaTotalAllocatedSize <<= C_uwShiftAllocSize;
|
||||
uaTotalFreeSize <<= C_uwShiftAllocSize;
|
||||
}
|
||||
}// end of the for block
|
||||
|
||||
Mmg_MLeaveCriticalSection();
|
||||
#endif
|
||||
}// Mmg_fn_vPrintUsedStaticMemory
|
||||
|
||||
|
||||
#ifdef DEBUG_SON
|
||||
#define NB_MALLOC_HISTO 10000
|
||||
typedef struct {
|
||||
void* pvPtr;
|
||||
unsigned long ulSize;
|
||||
} tdstMallocDescriptor;
|
||||
static tdstMallocDescriptor dbg_MallocHisto[NB_MALLOC_HISTO];
|
||||
static unsigned long dbg_ulNbDynMalloc=0;
|
||||
static unsigned long dbg_ulSizeDynMalloc=0;
|
||||
static unsigned long dbg_ulIdMaxDynMalloc=0;
|
||||
static unsigned long dbg_ulMaxSizeDynMalloc=0;
|
||||
static unsigned long dbg_ulNbMaxBlocs=0;
|
||||
|
||||
void dbg_fnMalloc(void* ptr,unsigned long size)
|
||||
{
|
||||
int i=0;
|
||||
tdstMallocDescriptor *decr=&dbg_MallocHisto[0];
|
||||
|
||||
while ((i<NB_MALLOC_HISTO) && (decr->pvPtr!=NULL)) {i++;decr++;};
|
||||
if (i<NB_MALLOC_HISTO)
|
||||
{
|
||||
decr->pvPtr=ptr;decr->ulSize=size;
|
||||
dbg_ulNbDynMalloc++;dbg_ulSizeDynMalloc+=size;
|
||||
if (dbg_ulSizeDynMalloc>dbg_ulMaxSizeDynMalloc)
|
||||
{
|
||||
dbg_ulMaxSizeDynMalloc=dbg_ulSizeDynMalloc;
|
||||
dbg_ulIdMaxDynMalloc=dbg_ulNbDynMalloc;
|
||||
dbg_ulNbMaxBlocs=0;decr=&dbg_MallocHisto[0];i=0;
|
||||
while (i<NB_MALLOC_HISTO)
|
||||
{
|
||||
decr++;i++;
|
||||
if (decr->pvPtr!=NULL) dbg_ulNbMaxBlocs++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dbg_fnReAlloc(void* oldptr,void* newptr,unsigned long size)
|
||||
{
|
||||
int i=0;
|
||||
tdstMallocDescriptor *decr=&dbg_MallocHisto[0];
|
||||
|
||||
while ((i<NB_MALLOC_HISTO) && (decr->pvPtr!=oldptr)) {i++;decr++;};
|
||||
if (i<NB_MALLOC_HISTO)
|
||||
{
|
||||
dbg_ulSizeDynMalloc-=decr->ulSize;dbg_ulSizeDynMalloc+=size;
|
||||
decr->pvPtr=newptr;decr->ulSize=size;
|
||||
if (dbg_ulSizeDynMalloc>dbg_ulMaxSizeDynMalloc)
|
||||
{
|
||||
dbg_ulMaxSizeDynMalloc=dbg_ulSizeDynMalloc;
|
||||
dbg_ulNbMaxBlocs=0;decr=&dbg_MallocHisto[0];i=0;
|
||||
while (i<NB_MALLOC_HISTO)
|
||||
{
|
||||
decr++;i++;
|
||||
if (decr->pvPtr!=NULL) dbg_ulNbMaxBlocs++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dbg_fnFree(void* ptr)
|
||||
{
|
||||
int i=0;
|
||||
tdstMallocDescriptor *decr=&dbg_MallocHisto[0];
|
||||
|
||||
while ((i<NB_MALLOC_HISTO) && (decr->pvPtr!=ptr)) {i++;decr++;}
|
||||
if (i<NB_MALLOC_HISTO)
|
||||
{
|
||||
dbg_ulSizeDynMalloc-=decr->ulSize;dbg_ulNbDynMalloc--;
|
||||
decr->pvPtr=NULL;decr->ulSize=0;
|
||||
}
|
||||
}
|
||||
|
||||
void dbg_fnReportDynMemory()
|
||||
{
|
||||
FILE* hFile;
|
||||
SYSTEMTIME time;
|
||||
|
||||
if ((hFile=fopen("sndmemrp.txt","aw"))!=NULL)
|
||||
{
|
||||
GetLocalTime(&time);
|
||||
fprintf(hFile,"--- Dynamic Memory used by SND ------------\xd\xa saved the %dth of %d, %d; at %2d:%2d:%2d\xd\xa",time.wMonth,time.wDay,time.wYear,time.wHour,time.wMinute,time.wSecond);
|
||||
fprintf(hFile,"Maximum of %d bytes segmented in %d blocks\xd\xa\xd\xa",dbg_ulMaxSizeDynMalloc,dbg_ulNbMaxBlocs);
|
||||
fclose(hFile);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NO_ACP_MEMORY
|
||||
#define C_SND_MAINBLOCK_SIZE 100*1024
|
||||
#define C_SND_MAPBLOCK_SIZE 10*1024
|
||||
|
||||
//----------------------------------------------------------
|
||||
// InitMallocSnd:init de la librairie MallocSnd
|
||||
//----------------------------------------------------------
|
||||
void SND_CALL SND_fn_vInitMallocSnd(void)
|
||||
{
|
||||
#ifdef MEMORY_ACCES_MANAGEMENT_MODE
|
||||
SND_fn_vInitMemoryAccessManagement();
|
||||
#endif
|
||||
|
||||
Mmg_M_InitMmg(Snd);
|
||||
|
||||
Mmg_M_InitBlock(Snd,E_ucSndBlockMain,C_SND_MAINBLOCK_SIZE);
|
||||
Mmg_M_InitBlock(Snd,E_ucSndBlockMap,C_SND_MAPBLOCK_SIZE);
|
||||
|
||||
SND_fn_vEnterCriticalSectionForErrorDisplay();
|
||||
|
||||
if (Erm_M_uwCheckError (Snd,(unsigned long)GetCurrentThreadId()))
|
||||
{
|
||||
Erm_M_ClearLastError((unsigned long)GetCurrentThreadId());
|
||||
Erm_M_UpdateLastError(Snd,(unsigned long)GetCurrentThreadId(),E_uwSndMemoryBlockError, C_lErmNoDebugData,C_ucErmOpenInfoWindow, C_ucAllowStopForDebug,"");
|
||||
}
|
||||
|
||||
SND_fn_vQuitCriticalSectionForErrorDisplay();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// InitMallocSnd:init de la librairie MallocSnd
|
||||
//----------------------------------------------------------
|
||||
void SND_CALL SND_fn_vDesInitMallocSnd(void)
|
||||
{
|
||||
#ifdef DEBUG_SON
|
||||
dbg_fnReportDynMemory();
|
||||
#endif
|
||||
|
||||
Mmg_M_FreeBlock(Snd,E_ucSndBlockMain);
|
||||
Mmg_M_FreeBlock(Snd,E_ucSndBlockMap);
|
||||
Mmg_M_DeleteBlock(Snd,E_ucSndBlockMain);
|
||||
Mmg_M_DeleteBlock(Snd,E_ucSndBlockMap);
|
||||
|
||||
#ifdef MEMORY_ACCES_MANAGEMENT_MODE
|
||||
SND_fn_vDesInitMemoryAccessManagement();
|
||||
#endif//MEMORY_ACCES_MANAGEMENT_MODE
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// MallocSnd:allocation d'un bloc m<>moire
|
||||
// Entr<74>e:ulNbByte=nb d'octets <20> r<>server
|
||||
// Sortie:pointeur sue le 1<> octet reserv<72>
|
||||
//----------------------------------------------------------
|
||||
void* SND_CALL SND_fn_pvMallocSnd(unsigned long ulNbBytes)
|
||||
{
|
||||
void* ptr_temp;
|
||||
unsigned char ucChannel;
|
||||
|
||||
ucChannel=Mmg_fn_ucGiveChannelId((unsigned long)GetCurrentThreadId(),0);
|
||||
|
||||
Mmg_M_SetModeAlloc4Ch(Snd,E_ucDynamic,ucChannel );
|
||||
|
||||
ptr_temp=Mmg_fn_p_vAlloc4Ch(ulNbBytes,ucChannel );
|
||||
|
||||
SND_fn_vEnterCriticalSectionForErrorDisplay();
|
||||
|
||||
if (Erm_M_uwCheckError(Mmg,(unsigned long)GetCurrentThreadId()))
|
||||
{
|
||||
SND_PrintUsedStaticMemory();
|
||||
Erm_M_ClearLastError((unsigned long)GetCurrentThreadId());
|
||||
SND_fn_vDisplayError(E_uwSndMemoryAllocError,"");
|
||||
ptr_temp=NULL;
|
||||
}
|
||||
|
||||
SND_fn_vQuitCriticalSectionForErrorDisplay();
|
||||
|
||||
Mmg_fn_vReleaseChannelId(ucChannel);
|
||||
|
||||
#ifdef DEBUG_SON
|
||||
dbg_fnMalloc(ptr_temp,ulNbBytes);
|
||||
#endif
|
||||
|
||||
return ptr_temp;
|
||||
}
|
||||
|
||||
void* SND_CALL SND_fn_pvMallocSndEx(unsigned char id_block,unsigned long ulNbBytes)
|
||||
{
|
||||
void* ptr_temp;
|
||||
#ifdef MEMORY_ACCES_MANAGEMENT_MODE
|
||||
ptr_temp=VirtualAlloc(NULL,ulNbBytes,MEM_COMMIT,PAGE_READWRITE);
|
||||
|
||||
if (id_block & MEMORY_ACCES_MANAGEMENT_FLAG)
|
||||
{
|
||||
|
||||
}
|
||||
#else
|
||||
unsigned char ucChannel;
|
||||
|
||||
SND_fn_vCheckMemory();
|
||||
|
||||
ucChannel=Mmg_fn_ucGiveChannelId((unsigned long)GetCurrentThreadId(),0);
|
||||
|
||||
Mmg_M_SetModeAlloc4Ch(Snd,id_block,ucChannel );
|
||||
|
||||
ptr_temp=Mmg_fn_p_vAlloc4Ch(ulNbBytes,ucChannel );
|
||||
|
||||
SND_fn_vEnterCriticalSectionForErrorDisplay();
|
||||
|
||||
if (Erm_M_uwCheckError(Mmg,(unsigned long)GetCurrentThreadId()))
|
||||
{
|
||||
SND_PrintUsedStaticMemory();
|
||||
Erm_M_ClearLastError((unsigned long)GetCurrentThreadId());
|
||||
SND_fn_vDisplayError(E_uwSndMemoryAllocError,"");
|
||||
ptr_temp=NULL;
|
||||
}
|
||||
|
||||
SND_fn_vQuitCriticalSectionForErrorDisplay();
|
||||
|
||||
Mmg_fn_vReleaseChannelId(ucChannel);
|
||||
|
||||
SND_fn_vCheckMemory();
|
||||
#endif //MEMORY_ACCES_MANAGEMENT_MODE
|
||||
|
||||
return ptr_temp;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
// ReAllocSnd:r<>-allocation d'un bloc m<>moire
|
||||
// Entr<74>e:pvPtr=pointeur sur le 1<> octet de la zone <20> r<>allouer
|
||||
// ulNbByte=nouveau nb d'octets <20> r<>server
|
||||
// Sortie:pointeur sue le 1<> octet reserv<72>
|
||||
//----------------------------------------------------------
|
||||
void* SND_CALL SND_fn_pvReAllocSnd(void* pvPtr,unsigned long ulNbBytes)
|
||||
{
|
||||
void * p_vPtr;
|
||||
unsigned char ucChannel;
|
||||
|
||||
ucChannel=Mmg_fn_ucGiveChannelId((unsigned long)GetCurrentThreadId(),0);
|
||||
|
||||
Mmg_M_SetModeAlloc4Ch(Snd,E_ucDynamic,ucChannel);
|
||||
|
||||
p_vPtr = Mmg_fn_p_vRealloc4Ch(pvPtr,ulNbBytes,ucChannel);
|
||||
|
||||
SND_fn_vEnterCriticalSectionForErrorDisplay();
|
||||
|
||||
if (Erm_M_uwCheckError(Mmg,(unsigned long)GetCurrentThreadId()))
|
||||
{
|
||||
SND_PrintUsedStaticMemory();
|
||||
Erm_M_ClearLastError((unsigned long)GetCurrentThreadId());
|
||||
SND_fn_vDisplayError(E_uwSndMemoryAllocError,"");
|
||||
}
|
||||
|
||||
SND_fn_vQuitCriticalSectionForErrorDisplay();
|
||||
|
||||
Mmg_fn_vReleaseChannelId(ucChannel);
|
||||
|
||||
#ifdef DEBUG_SON
|
||||
dbg_fnReAlloc(pvPtr,p_vPtr,ulNbBytes);
|
||||
#endif
|
||||
|
||||
return p_vPtr;
|
||||
}
|
||||
|
||||
void* SND_CALL SND_fn_pvReAllocSndEx(unsigned char id_block,void* pvPtr,unsigned long ulNbBytes)
|
||||
{
|
||||
void * newPtr;
|
||||
#ifdef MEMORY_ACCES_MANAGEMENT_MODE
|
||||
MEMORY_BASIC_INFORMATION mem_info;
|
||||
DWORD ret,prev_size,prev_protect;
|
||||
|
||||
newPtr=VirtualAlloc(0,ulNbBytes,MEM_COMMIT,PAGE_READWRITE);
|
||||
if (!newPtr)
|
||||
ret=GetLastError();
|
||||
else
|
||||
{
|
||||
VirtualQuery(pvPtr,&mem_info,sizeof(MEMORY_BASIC_INFORMATION));
|
||||
prev_size=mem_info.RegionSize;
|
||||
if (!(mem_info.Protect & PAGE_READWRITE))
|
||||
VirtualProtect(pvPtr,prev_size,PAGE_READWRITE,&prev_protect);
|
||||
CopyMemory(newPtr,pvPtr,min(ulNbBytes,prev_size));
|
||||
if (!VirtualFree(pvPtr,0,MEM_RELEASE))
|
||||
ret=GetLastError();
|
||||
}
|
||||
|
||||
if (id_block & MEMORY_ACCES_MANAGEMENT_FLAG)
|
||||
VirtualProtect(newPtr,ulNbBytes,PAGE_READONLY,&prev_protect);
|
||||
|
||||
snd_assert(newPtr);
|
||||
#else
|
||||
unsigned char ucChannel;
|
||||
|
||||
SND_fn_vCheckMemory();
|
||||
|
||||
ucChannel=Mmg_fn_ucGiveChannelId((unsigned long)GetCurrentThreadId(),0);
|
||||
|
||||
Mmg_M_SetModeAlloc4Ch(Snd,id_block,ucChannel);
|
||||
|
||||
newPtr = Mmg_fn_p_vRealloc4Ch(pvPtr,ulNbBytes,ucChannel );
|
||||
|
||||
SND_fn_vEnterCriticalSectionForErrorDisplay();
|
||||
|
||||
if (Erm_M_uwCheckError(Mmg,(unsigned long)GetCurrentThreadId()))
|
||||
{
|
||||
SND_PrintUsedStaticMemory();
|
||||
Erm_M_ClearLastError((unsigned long)GetCurrentThreadId());
|
||||
SND_fn_vDisplayError(E_uwSndMemoryAllocError,"");
|
||||
}
|
||||
|
||||
SND_fn_vQuitCriticalSectionForErrorDisplay();
|
||||
|
||||
Mmg_fn_vReleaseChannelId(ucChannel);
|
||||
|
||||
SND_fn_vCheckMemory();
|
||||
#endif //MEMORY_ACCES_MANAGEMENT_MODE
|
||||
|
||||
return newPtr;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// FreeSnd:lib<69>ration d'un bloc m<>moire
|
||||
// Entr<74>e:pvPtr=pointeur sur le 1<> octet de la zone <20> lib<69>rer
|
||||
//----------------------------------------------------------
|
||||
void SND_CALL SND_fn_vFreeSnd(void* pvPtr)
|
||||
{
|
||||
unsigned char ucChannel;
|
||||
|
||||
ucChannel=Mmg_fn_ucGiveChannelId((unsigned long)GetCurrentThreadId(),0);
|
||||
|
||||
Mmg_M_SetModeAlloc4Ch(Snd,E_ucDynamic,ucChannel);
|
||||
|
||||
Mmg_fn_vTestMallocIntegrityAt (pvPtr);
|
||||
|
||||
Mmg_fn_vFree4Ch(pvPtr,ucChannel);
|
||||
|
||||
SND_fn_vEnterCriticalSectionForErrorDisplay();
|
||||
|
||||
if (Erm_M_uwCheckError(Mmg, (unsigned long)GetCurrentThreadId()))
|
||||
{
|
||||
Erm_M_ClearLastError((unsigned long)GetCurrentThreadId());
|
||||
SND_fn_vDisplayError(E_uwSndMemoryAllocError,"");
|
||||
}
|
||||
|
||||
SND_fn_vQuitCriticalSectionForErrorDisplay();
|
||||
|
||||
Mmg_fn_vReleaseChannelId(ucChannel);
|
||||
|
||||
#ifdef DEBUG_SON
|
||||
dbg_fnFree(pvPtr);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SND_CALL SND_fn_vFreeSndEx(unsigned char id_block,void* pvPtr)
|
||||
{
|
||||
#ifdef MEMORY_ACCES_MANAGEMENT_MODE
|
||||
VirtualFree(pvPtr,0,MEM_RELEASE);
|
||||
#else
|
||||
unsigned char ucChannel;
|
||||
long toto=(long)GetCurrentThreadId();
|
||||
|
||||
SND_fn_vCheckMemory();
|
||||
|
||||
ucChannel=Mmg_fn_ucGiveChannelId((unsigned long)GetCurrentThreadId(),0);
|
||||
|
||||
Mmg_M_SetModeAlloc4Ch(Snd,id_block,ucChannel );
|
||||
|
||||
Mmg_fn_vTestMallocIntegrityAt (pvPtr);
|
||||
|
||||
Mmg_fn_vFree4Ch(pvPtr,ucChannel);
|
||||
|
||||
SND_fn_vEnterCriticalSectionForErrorDisplay();
|
||||
|
||||
if (Erm_M_uwCheckError(Mmg, (unsigned long)GetCurrentThreadId()))
|
||||
{
|
||||
Erm_M_ClearLastError((unsigned long)GetCurrentThreadId());
|
||||
SND_fn_vDisplayError(E_uwSndMemoryAllocError,"");
|
||||
}
|
||||
|
||||
SND_fn_vQuitCriticalSectionForErrorDisplay();
|
||||
|
||||
Mmg_fn_vReleaseChannelId(ucChannel);
|
||||
|
||||
SND_fn_vCheckMemory();
|
||||
#endif //MEMORY_ACCES_MANAGEMENT_MODE
|
||||
}
|
||||
|
||||
void SND_CALL SND_fn_vResizeMemoryBlockSnd(unsigned char id,unsigned long size)
|
||||
{
|
||||
Mmg_M_InitBlock(Snd,id,size);
|
||||
}
|
||||
|
||||
void SND_PrintUsedStaticMemory(void)
|
||||
{
|
||||
Mmg_M_PrintUsedStaticMemoryInModule(Snd);
|
||||
}
|
||||
|
||||
#ifdef MEMORY_ACCES_MANAGEMENT_MODE
|
||||
//Exception filter for SND acces viloation management
|
||||
LONG WINAPI SND_fn_lUnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
|
||||
{
|
||||
char texte[128];
|
||||
|
||||
if (ExceptionInfo->ExceptionRecord->ExceptionCode==EXCEPTION_ACCESS_VIOLATION)
|
||||
{
|
||||
sprintf(texte,"Tentative d'<27>crasement m<>moire en %x",ExceptionInfo->ExceptionRecord->ExceptionInformation[1]);
|
||||
if (MessageBox(NULL,"Do you want to (attempt to) modify bloc attributs ?",texte,MB_YESNO)==IDYES)
|
||||
SND_fn_vLockMemoryWriteSnd_((void*)ExceptionInfo->ExceptionRecord->ExceptionInformation[1]);
|
||||
}
|
||||
else
|
||||
MessageBox(NULL,"<EFBFBD>a va mal","ou<EFBFBD>lle",MB_OK);
|
||||
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
void SND_fn_vInitMemoryAccessManagement()
|
||||
{
|
||||
g_pfnPrevExceptionHandler=SetUnhandledExceptionFilter(SND_fn_lUnhandledExceptionFilter);
|
||||
}
|
||||
|
||||
void SND_fn_vDesInitMemoryAccessManagement()
|
||||
{
|
||||
SetUnhandledExceptionFilter(g_pfnPrevExceptionHandler);
|
||||
}
|
||||
|
||||
void SND_CALL SND_fn_vLockMemoryWriteSnd_(void* ptr)
|
||||
{
|
||||
MEMORY_BASIC_INFORMATION mem_info;
|
||||
DWORD prev_protect;
|
||||
|
||||
VirtualQuery(ptr,&mem_info,sizeof(MEMORY_BASIC_INFORMATION));
|
||||
snd_assert(mem_info.RegionSize);
|
||||
snd_assert(mem_info.Protect==PAGE_READONLY);
|
||||
|
||||
VirtualProtect(ptr,mem_info.RegionSize,PAGE_READWRITE,&prev_protect);
|
||||
}
|
||||
|
||||
void SND_CALL SND_fn_vLockMemoryReadSnd_(void* ptr)
|
||||
{
|
||||
MEMORY_BASIC_INFORMATION mem_info;
|
||||
DWORD prev_protect;
|
||||
|
||||
VirtualQuery(ptr,&mem_info,sizeof(MEMORY_BASIC_INFORMATION));
|
||||
snd_assert(mem_info.RegionSize);
|
||||
snd_assert(mem_info.Protect==PAGE_READONLY);
|
||||
|
||||
VirtualProtect(ptr,mem_info.RegionSize,PAGE_READONLY,&prev_protect);
|
||||
}
|
||||
|
||||
void SND_CALL SND_fn_vUnLockMemoryWriteSnd_(void* ptr)
|
||||
{
|
||||
MEMORY_BASIC_INFORMATION mem_info;
|
||||
DWORD prev_protect;
|
||||
|
||||
VirtualQuery(ptr,&mem_info,sizeof(MEMORY_BASIC_INFORMATION));
|
||||
snd_assert(mem_info.RegionSize);
|
||||
snd_assert(mem_info.Protect==PAGE_READWRITE);
|
||||
|
||||
VirtualProtect(ptr,mem_info.RegionSize,PAGE_READONLY,&prev_protect);
|
||||
}
|
||||
|
||||
void SND_CALL SND_fn_vUnLockMemoryReadSnd_(void* ptr)
|
||||
{
|
||||
MEMORY_BASIC_INFORMATION mem_info;
|
||||
DWORD prev_protect;
|
||||
|
||||
VirtualQuery(ptr,&mem_info,sizeof(MEMORY_BASIC_INFORMATION));
|
||||
snd_assert(mem_info.RegionSize);
|
||||
snd_assert(mem_info.Protect==PAGE_READONLY);
|
||||
|
||||
VirtualProtect(ptr,mem_info.RegionSize,PAGE_READONLY,&prev_protect);
|
||||
}
|
||||
#endif //MEMORY_ACCES_MANAGEMENT_MODE
|
||||
|
||||
#else //NO_ACP_MEMORY
|
||||
//----------------------------------------------------------
|
||||
// InitMallocSnd:init de la librairie MallocSnd
|
||||
//----------------------------------------------------------
|
||||
void SND_CALL SND_fn_vInitMallocSnd(void)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// InitMallocSnd:init de la librairie MallocSnd
|
||||
//----------------------------------------------------------
|
||||
void SND_CALL SND_fn_vDesInitMallocSnd(void)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// MallocSnd:allocation d'un bloc m<>moire
|
||||
// Entr<74>e:ulNbByte=nb d'octets <20> r<>server
|
||||
// Sortie:pointeur sue le 1<> octet reserv<72>
|
||||
//----------------------------------------------------------
|
||||
void* SND_CALL SND_fn_pvMallocSnd(unsigned long ulNbBytes)
|
||||
{
|
||||
return VirtualAlloc(0,ulNbBytes,MEM_COMMIT,PAGE_READWRITE);
|
||||
}
|
||||
|
||||
void* SND_CALL SND_fn_pvMallocSndEx(unsigned char id,unsigned long ulNbBytes)
|
||||
{
|
||||
return SND_fn_pvMallocSnd(ulNbBytes);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// ReAllocSnd:r<>-allocation d'un bloc m<>moire
|
||||
// Entr<74>e:pvPtr=pointeur sur le 1<> octet de la zone <20> r<>allouer
|
||||
// ulNbByte=nouveau nb d'octets <20> r<>server
|
||||
// Sortie:pointeur sue le 1<> octet reserv<72>
|
||||
//----------------------------------------------------------
|
||||
void* SND_CALL SND_fn_pvReAllocSnd(void* pvPtr,unsigned long ulNbBytes)
|
||||
{
|
||||
void *new_pvPtr;
|
||||
DWORD ret;
|
||||
MEMORY_BASIC_INFORMATION mem_info;
|
||||
DWORD prev_size;
|
||||
|
||||
if (pvPtr != NULL)
|
||||
{
|
||||
new_pvPtr=VirtualAlloc(0,ulNbBytes,MEM_COMMIT,PAGE_READWRITE);
|
||||
if (!new_pvPtr)
|
||||
ret=GetLastError();
|
||||
else
|
||||
{
|
||||
VirtualQuery(pvPtr,&mem_info,sizeof(MEMORY_BASIC_INFORMATION));
|
||||
prev_size=mem_info.RegionSize;
|
||||
CopyMemory(new_pvPtr,pvPtr,min(ulNbBytes,prev_size));
|
||||
if (!VirtualFree(pvPtr,0,MEM_RELEASE))
|
||||
ret=GetLastError();
|
||||
}
|
||||
}
|
||||
else
|
||||
new_pvPtr=NULL;
|
||||
|
||||
return new_pvPtr;
|
||||
}
|
||||
|
||||
void* SND_CALL SND_fn_pvReAllocSndEx(unsigned char id,void* pvPtr,unsigned long ulNbBytes)
|
||||
{
|
||||
return SND_fn_pvReAllocSnd(pvPtr,ulNbBytes);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// FreeSnd:lib<69>ration d'un bloc m<>moire
|
||||
// Entr<74>e:pvPtr=pointeur sur le 1<> octet de la zone <20> lib<69>rer
|
||||
//----------------------------------------------------------
|
||||
void SND_CALL SND_fn_vFreeSnd(void* pvPtr)
|
||||
{
|
||||
DWORD ret;
|
||||
|
||||
if (pvPtr != NULL)
|
||||
if (!VirtualFree(pvPtr,0,MEM_RELEASE))
|
||||
ret=GetLastError();
|
||||
}
|
||||
|
||||
void SND_CALL SND_fn_vFreeSndEx(unsigned char id,void* pvPtr)
|
||||
{
|
||||
SND_fn_vFreeSnd(pvPtr);
|
||||
}
|
||||
|
||||
void SND_CALL SND_fn_vResizestaticBlockSnd(int id,long size)
|
||||
{
|
||||
}
|
||||
|
||||
void SND_PrintUsedStaticMemory (void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif //NO_ACP_MEMORY
|
||||
|
Reference in New Issue
Block a user