Update to v106r69 release.

byuu says:

The biggest change was improving WonderSwan emulation. With help from
trap15, I tracked down a bug where I was checking the wrong bit for
reverse DMA transfers. Then I also emulated VTOTAL to support variable
refresh rate. Then I improved HyperVoice emulation which should be
unsigned samples in three of four modes. That got Fire Lancer running
great. I also rewrote the disassembler. The old one disassembled many
instructions completely wrong, and deviated too much from any known x86
syntax. I also emulated some of the quirks of the V30 (two-byte POP into
registers fails, SALC is just XLAT mirrored, etc) which probably don't
matter unless someone tries to run code to verify it's a NEC CPU and not
an Intel CPU, but hey, why not?

I also put more work into the MSX skeleton, but it's still just a
skeleton with no real emulation yet.
This commit is contained in:
Tim Allen
2019-01-02 10:52:08 +11:00
parent 3159285eaa
commit aaf094e7c4
115 changed files with 3319 additions and 1394 deletions

32
nall/string/utf8.hpp Normal file
View File

@@ -0,0 +1,32 @@
#pragma once
namespace nall {
//note: this function assumes the string contains valid UTF-8 characters
//invalid characters will result in an incorrect result from this function
//invalid case 1: byte 1 == 0b'01xxxxxx
//invalid case 2: bytes 2-4 != 0b'10xxxxxx
//invalid case 3: end of string without bytes 2-4 present
auto characters(string_view self, int offset, int length) -> uint {
uint characters = 0;
if(offset < 0) offset = self.size() - abs(offset);
if(offset >= 0 && offset < self.size()) {
if(length < 0) length = self.size() - offset;
if(length >= 0) {
for(int index = offset; index < offset + length;) {
auto byte = self.data()[index++];
if((byte & 0b111'00000) == 0b110'00000) index += 1;
if((byte & 0b1111'0000) == 0b1110'0000) index += 2;
if((byte & 0b11111'000) == 0b11110'000) index += 3;
characters++;
}
}
}
return characters;
}
auto string::characters(int offset, int length) const -> uint {
return nall::characters(*this, offset, length);
}
}