mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Large blob code cleanup. Compressed ISO ("gcz") support reactivated. Beginnings of raw drive reading code. Deprecate file mapping in an ugly way.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@566 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -18,7 +18,14 @@
|
||||
#ifndef _COMMON_H
|
||||
#define _COMMON_H
|
||||
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#define _CRTDBG_MAP_ALLOC_NEW
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _DEBUG
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
#include "../../../PluginSpecs/CommonTypes.h"
|
||||
#else
|
||||
#include "CommonTypes.h"
|
||||
|
57
Source/Core/Common/Src/DriveUtil.cpp
Normal file
57
Source/Core/Common/Src/DriveUtil.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <winioctl.h>
|
||||
#endif
|
||||
|
||||
void GetAllRemovableDrives(std::vector<std::string> *drives) {
|
||||
drives->clear();
|
||||
#ifdef _WIN32
|
||||
HANDLE hDisk;
|
||||
DISK_GEOMETRY diskGeometry;
|
||||
|
||||
for (int i = 'A'; i < 'Z'; i++)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
sprintf(path, "\\\\.\\%c:", i);
|
||||
hDisk = CreateFile(path, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
|
||||
if (hDisk != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
DWORD dwBytes;
|
||||
DeviceIoControl(hDisk, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, &diskGeometry, sizeof(DISK_GEOMETRY), &dwBytes, NULL);
|
||||
// Only proceed if disk is a removable media
|
||||
if (diskGeometry.MediaType == RemovableMedia)
|
||||
{
|
||||
if (diskGeometry.BytesPerSector == 2048) {
|
||||
// Probably CD/DVD drive.
|
||||
// "Remove" the "\\.\" part of the path and return it.
|
||||
drives->push_back(path + 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
CloseHandle(hDisk);
|
||||
}
|
||||
#else
|
||||
// TODO
|
||||
// stat("/media/cdrom") or whatever etc etc
|
||||
#endif
|
||||
}
|
||||
|
28
Source/Core/Common/Src/DriveUtil.h
Normal file
28
Source/Core/Common/Src/DriveUtil.h
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _DRIVEUTIL_H
|
||||
#define _DRIVEUTIL_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// Tools to enumerate drives (HDD, DVD, CD) in a platform-independent manner.
|
||||
|
||||
void GetAllRemovableDrives(std::vector<std::string> *drives);
|
||||
|
||||
#endif
|
@ -28,7 +28,7 @@ public:
|
||||
static void Explore(const std::string &path);
|
||||
static bool IsDirectory(const std::string &filename);
|
||||
static bool CreateDir(const std::string &filename);
|
||||
static std::string GetUserDirectory();
|
||||
static std::string GetUserDirectory();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
u32 HashFletcher(const u8* data_u8, size_t length); // FAST
|
||||
u32 HashFletcher(const u8* data_u8, size_t length); // FAST. Length & 1 == 0.
|
||||
u32 HashAdler32(const u8* data, size_t len); // Fairly accurate, slightly slower
|
||||
u32 HashFNV(const u8* ptr, int length); // Another fast and decent hash
|
||||
u32 HashEctor(const u8* ptr, int length); // JUNK. DO NOT USE FOR NEW THINGS
|
||||
|
@ -226,7 +226,7 @@ void CMappedFile::Unlock(u8* ptr)
|
||||
}
|
||||
|
||||
|
||||
IMappedFile* IMappedFile::CreateMappedFile(void)
|
||||
IMappedFile* IMappedFile::CreateMappedFileDEPRECATED(void)
|
||||
{
|
||||
return(new CMappedFile);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class IMappedFile
|
||||
virtual u8* Lock(u64 _offset, u64 _size) = 0;
|
||||
virtual void Unlock(u8* ptr) = 0;
|
||||
|
||||
static IMappedFile* CreateMappedFile();
|
||||
static IMappedFile* CreateMappedFileDEPRECATED();
|
||||
};
|
||||
} // end of namespace DiscIO
|
||||
|
||||
|
Reference in New Issue
Block a user