function get_default_save_data()
{
	return
	{
		player:
		{
			maxHP: 6,
			maxINK: 9,
			Credit: 0,
			
			abilities:
			{
				dash: false,
				wall_climb: false,
				double_jump: false
			},
			corpse:
			{
				targetRoom: noone,
				xPos: -1,
				yPos: -1,
				droppedCredit: 0
			}
		},
		world:
		{
			current_room: "rTest_2",
			current_savepoint: "rTest2_sp1",
			destroyed_objects: {}, 
            defeated_boss: {}
		}/*,
		meta:
		{
			play_time: 0,
			save_date: ""
		}*/
	}
}
function save_game_to_disk()
{
	// 更新元数据
	// global.save_data.meta.save_date = date_datetime_string(date_current_datetime());
	
	// 序列化
	var _json_string = json_stringify(global.save_data);
	
	// 使用buffer写入
	var _buffer = buffer_create(string_byte_length(_json_string) + 1, buffer_fixed, 1);
	buffer_write(_buffer, buffer_string, _json_string);
    buffer_save(_buffer, global.save_filename);
    buffer_delete(_buffer);
	
	if global.developer_mode
		show_debug_message("The game has been saved to " + global.save_filename);
}
function load_game_from_disk()
{
	if !file_exists(global.save_filename)
		return;
		
	// 使用buffer读取
	var _buffer = buffer_load(global.save_filename);
    var _json_string = buffer_read(_buffer, buffer_string);
    buffer_delete(_buffer);
    
    // 反序列化
    var _loaded_data = json_parse(_json_string);
    
    // 覆盖当前的全局存档数据
    global.save_data = _loaded_data;
    
	room_goto(asset_get_index(global.save_data.world.current_room));
	
	global.in_game_manager = icl(oInGameManager);
}