件名のエラーについてお伺いします。
ソースをデバッグして、実行結果のbreakまでの動作を確認していました。
横スクリーンのアクションゲームを作っていたのですが、
ある程度動かしてキチンと終了したかと思うと「 0x6e0a0a38 でハンドルされていない例外が発生しました: 0xC0000005: 場所 0x6bdba636 に書き込み中にアクセス違反が発生しました。」
とエラーがでて以後デバッグすらできなくなりました。
ccrt0dat.cというクラス? がでて矢印でエラーが指されているんですがなんのことだかさっぱりわかりません。
void __cdecl __crtExitProcess (
int status
)
{
__crtCorExitProcess(status);
/*
* Either mscoree.dll isn't loaded,
* or CorExitProcess isn't exported from mscoree.dll,
* or CorExitProcess returned (should never happen).
* Just call ExitProcess.
*/
→ ExitProcess(status);
}
それをやったとたんに出てきました。
解決を探しています。何卒、よろしくおねがいしますorz
一応、ソースの全文も載せておきます。
#include "DxLib.h"
#include <time.h>
#include <math.h>
#define WINDOW_SIZE_X 640
#define WINDOW_SIZE_Y 480
#define STAGE1_END_X 1920
#define ENEMY_RANGE_MAX 4
#define CSHOT_RANGE_MAX 2
int White;
char Key[256] ;
//場面処理用
int function_status;
//カメラ
int camerax=0,cameray=0;
//キャラクターシート
int image[12];
int image_enemy;
int image_op;
//弾画像
int image_tama;
//背景画像
int image_stage;
//発射してからのカウントをする変数。
int counter=0;
//始まった時間
int StartTime;
struct shot{
int x,y;
int flag;
};
typedef struct{
int x,y,img,muki,walking_flag,attack_flag;
}ch_t;
ch_t ch;//キャラクターの位置
typedef struct{
int x,y,img,muki,flag,attack_flag,hp;
}enemy_t;
enemy_t en;
struct shot tama[50];
void op0(){
DrawGraph( 0 , 0 , image_op , TRUE ) ;//画像を描画
//Xキーが押されてたら
if(Key[KEY_INPUT_RETURN]==1)
function_status=1;}
void main1(){
int i;
if((GetNowCount() - StartTime) > 60000){ //1ステージの制限時間は6秒
function_status=2;
}
if(ch.x%30==0){ //座標が30で割り切れたら入力可能
ch.walking_flag=1;//歩くフラグを立てる。
if( Key[ KEY_INPUT_RIGHT ] == 1 ) //→ボタンが押されたら
ch.muki=1; //右向きフラグを立てる
else if( Key[ KEY_INPUT_LEFT ] == 1 ) //→ボタンが押されたら
ch.muki=2; //←向きフラグを立てる
else
//何のボタンも押されてなかったら
ch.walking_flag=0; //歩かないフラグを立てる
if( Key[ KEY_INPUT_SPACE ] == 1 )
ch.attack_flag=1;//攻撃フラグをタテル。
}
if(ch.walking_flag==1){ //歩くフラグが立っていたら
if(ch.muki==1){ //→向きならch.x座標を増やす
ch.x+=2;
ch.img=image[(ch.x%30)/5 +6]; }
else if(ch.muki==2){ //→向きならch.x座標を増やす
ch.x--;
ch.img=image[(ch.x%30)/5 +6]; }}
else if(ch.walking_flag==0){
ch.img=image[(ch.x%30)/2+0];
}
if(ch.attack_flag==1){
ch.img=image[(ch.x%10)/5+2];
ch.attack_flag=0;
}
if(counter<5) //前にエンターを押してから5カウント未満なら
counter++; //カウントアップ
else if( Key[ KEY_INPUT_SPACE] == 1 ){//5カウント以上たっていたら
counter=0;//カウンターを戻す
for(i=0;i<50;i++){
if(tama[i].flag==0){ //発射していない玉を探し、
tama[i].x=ch.x+100;
tama[i].y=ch.y;
tama[i].flag=1; //発射フラグを立てる
break;
}
}
}
camerax=ch.x;
if(camerax<0) camerax=0;
if(camerax>1280) camerax=1280;
DrawGraph( -camerax , -cameray ,image_stage, TRUE);//ステージを描画
DrawGraph( ch.x-camerax , ch.y-cameray , ch.img , TRUE ) ;//画像を描画
for(i=0;i<50;i++){
if(tama[i].flag==1){ //発射している玉なら
tama[i].x+=5; //xをキャラ位置分増やす
DrawGraph( tama[i].x-camerax , tama[i].y-cameray , image_tama , TRUE );//玉を描画
if(tama[i].x < -32+camerax || tama[i].x > 672+camerax){ //もし画面外まで来たら
tama[i].flag=0; //発射フラグを戻す
}
}
srand((unsigned) time(NULL));
int c, n;
for (c=0; c<480; c++) {
n = rand() % 240; //
}
int z, r;
for (z=0; z<640; z++) {
r = rand() % 640; //
}
en.x=r;
en.y=n;
if(en.x>camerax) en.flag=1;
if(en.flag==1){
en.x=500+-r;
en.y=240+-n;
DrawGraph(en.x, en.y , image_enemy , TRUE ) ;//画像を描画
}
}
if(ch.x>STAGE1_END_X-150)
function_status=2;
if(Key[KEY_INPUT_X]==1)
function_status=2;
}
void boss(){
White = GetColor( 255 , 255 , 255 ) ; // 白色の値を取得
if(Key[KEY_INPUT_Z]==1){
DrawString(100,100, "Zを押せ!" , White);;}
function_status=3;
}
void end(){ White = GetColor( 255 , 255 , 255 ) ; // 白色の値を取得
if(Key[KEY_INPUT_Z]==1){
DrawString(100,100, "Zを押せ!" , White);;}
function_status=3;
}
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow ){
ChangeWindowMode(TRUE);//ウィンドウモード
if(DxLib_Init() == -1 || SetDrawScreen( DX_SCREEN_BACK )!=0) return -1;//初期化と裏画面化
function_status=0;
image_enemy=LoadGraph("enemy.png");
image_op=LoadGraph("op.png");
image_tama = LoadGraph("tama.png");
LoadDivGraph( "chara_sheet.png" , 12 , 3 , 4 , 250 , 250 , image );//画像を分割してimage配列に保存
image_stage = LoadGraph( "stage.png" ) ;//背景の読み込み
ch.x =0;
ch.y =240;
ch.muki=3;
ch.attack_flag;
ch.walking_flag=0;
int i;
for(i=0;i<50;i++){ //初期化処理
tama[i].x=640/2; tama[i].y=480; //座標代入
tama[i].flag=0; //飛んでいない事を示すフラグ=0
}
//初期化処理
if(en.x=640/2,en.y=480)en.flag=0;
StartTime = GetNowCount();
while(ProcessMessage()==0 && ClearDrawScreen()==0 && !GetHitKeyStateAll(Key) && Key[KEY_INPUT_ESCAPE]==0){
//↑メッセージ処理 ↑画面をクリア ↑入力状態を保存 ↑ESCが押されていない
switch(function_status){
case 0:
op0();
break;
case 1:
main1();
break;
case 2:
boss();
break;
case 3:
end();
break;
default:
DxLib_End() ; // DXライブラリ使用の終了処理
return 0;
break;
}
ScreenFlip();
}
DxLib_End();
return 0;
}