Update to v101r02 release.

byuu says:

Changelog:

  - Emulator: use `(uintmax)-1 >> 1` for the units of time
  - MD: implemented 13 new 68K instructions (basically all of the
    remaining easy ones); 21 remain
  - nall: replaced `(u)intmax_t` (64-bit) with *actual* `(u)intmax` type
    (128-bit where available)
      - this extends to everything: atoi, string, etc. You can even
        print 128-bit variables if you like

22,552 opcodes still don't exist in the 68K map. Looking like quite a
few entries will be blank once I finish.
This commit is contained in:
Tim Allen
2016-08-09 21:07:18 +10:00
parent 8bdf8f2a55
commit 0a57cac70c
27 changed files with 703 additions and 202 deletions

View File

@@ -5,7 +5,7 @@ namespace nall { namespace Decode {
struct BMP {
BMP() = default;
BMP(const string& filename) { load(filename); }
BMP(const uint8_t* data, unsigned size) { load(data, size); }
BMP(const uint8_t* data, uint size) { load(data, size); }
explicit operator bool() const { return _data; }
@@ -15,28 +15,28 @@ struct BMP {
auto data() -> uint32_t* { return _data; }
auto data() const -> const uint32_t* { return _data; }
auto width() const -> unsigned { return _width; }
auto height() const -> unsigned { return _height; }
auto width() const -> uint { return _width; }
auto height() const -> uint { return _height; }
auto load(const string& filename) -> bool {
auto buffer = file::read(filename);
return load(buffer.data(), buffer.size());
}
auto load(const uint8_t* data, unsigned size) -> bool {
auto load(const uint8_t* data, uint size) -> bool {
if(size < 0x36) return false;
const uint8_t* p = data;
if(read(p, 2) != 0x4d42) return false; //signature
read(p, 8);
unsigned offset = read(p, 4);
uint offset = read(p, 4);
if(read(p, 4) != 40) return false; //DIB size
signed width = read(p, 4);
int width = read(p, 4);
if(width < 0) return false;
signed height = read(p, 4);
int height = read(p, 4);
bool flip = height < 0;
if(flip) height = -height;
read(p, 2);
unsigned bitsPerPixel = read(p, 2);
uint bitsPerPixel = read(p, 2);
if(bitsPerPixel != 24 && bitsPerPixel != 32) return false;
if(read(p, 4) != 0) return false; //compression type
@@ -44,9 +44,9 @@ struct BMP {
_height = height;
_data = new uint32_t[width * height];
unsigned bytesPerPixel = bitsPerPixel / 8;
unsigned alignedWidth = width * bytesPerPixel;
unsigned paddingLength = 0;
uint bytesPerPixel = bitsPerPixel / 8;
uint alignedWidth = width * bytesPerPixel;
uint paddingLength = 0;
while(alignedWidth % 4) alignedWidth++, paddingLength++;
p = data + offset;
@@ -63,12 +63,12 @@ struct BMP {
private:
uint32_t* _data = nullptr;
unsigned _width = 0;
unsigned _height = 0;
uint _width = 0;
uint _height = 0;
auto read(const uint8_t*& buffer, unsigned length) -> uintmax_t {
uintmax_t result = 0;
for(auto n : range(length)) result |= (uintmax_t)*buffer++ << (n << 3);
auto read(const uint8_t*& buffer, uint length) -> uintmax {
uintmax result = 0;
for(auto n : range(length)) result |= (uintmax)*buffer++ << (n << 3);
return result;
}
};