void CGalacticMapSession::OnUpdate (bool bTopMost) // OnUpdate // // Update { if (m_pPainter == NULL) return; if (m_Scale.Update()) { m_pPainter->SetScale(m_Scale.GetScale()); HIInvalidate(); } if (m_xCenter != m_xTargetCenter || m_yCenter != m_yTargetCenter) { int xDiff = m_xTargetCenter - m_xCenter; int yDiff = m_yTargetCenter - m_yCenter; m_xCenter = (Absolute(xDiff) > 1 ? m_xCenter + (xDiff / 2) : m_xTargetCenter); m_yCenter = (Absolute(yDiff) > 1 ? m_yCenter + (yDiff / 2) : m_yTargetCenter); m_pPainter->SetPos(m_xCenter, m_yCenter); HIInvalidate(); } }
hacd::HaF64 Determinant2x2 (const hacd::HaF64 matrix[2][2], hacd::HaF64* const error) { hacd::HaF64 a00xa11 = matrix[0][0] * matrix[1][1]; hacd::HaF64 a01xa10 = matrix[0][1] * matrix[1][0]; *error = Absolute(a00xa11) + Absolute(a01xa10); return a00xa11 - a01xa10; }
dgFloat64 Determinant2x2 (const dgFloat64 matrix[2][2], dgFloat64* const error) { dgFloat64 a00xa11 = matrix[0][0] * matrix[1][1]; dgFloat64 a01xa10 = matrix[0][1] * matrix[1][0]; *error = Absolute(a00xa11) + Absolute(a01xa10); return a00xa11 - a01xa10; }
bool Path::CopyDir(String srcFolder, String dstFolder) { srcFolder = Absolute(srcFolder); // Remove trailing seperators dstFolder = Absolute(dstFolder); dstFolder.TrimBack(Path::sep); if(!CreateDir(dstFolder)) return false; Vector<FileInfo> files = Files::ScanFiles(srcFolder); for(auto& file : files) { String commonPath = RemoveBase(file.fullPath, srcFolder); String dstPath = dstFolder + Path::sep + commonPath; if(file.type == FileType::Folder) { if(!CopyDir(file.fullPath, dstPath)) return false; } else { if(!Copy(file.fullPath, dstPath)) return false; } } return true; }
bool CBoltEffectCreator::PointInImage (int x, int y, int iTick, int iVariant) const // PointInImage // // Returns TRUE if the given point is in the image { return (Absolute(x) < m_iWidth && Absolute(y) < m_iWidth); }
bool CBeamEffectCreator::PointInImage (int x, int y, int iTick, int iVariant) const // PointInImage // // Returns TRUE if the given point is in the image { return (Absolute(x) < m_iIntensity && Absolute(y) < m_iIntensity); }
static inline bool Diff(int c1, int c2) { int c1y = (c1 & Ymask) - (c2 & Ymask); if (Absolute(c1y) > trY) return true; int c1u = (c1 & Umask) - (c2 & Umask); if (Absolute(c1u) > trU) return true; int c1v = (c1 & Vmask) - (c2 & Vmask); if (Absolute(c1v) > trV) return true; return false; }
bool CRayEffectPainter::PointInImage (int x, int y, int iTick, int iVariant, int iRotation) const // PointInImage // // Returns TRUE if the given point is in the image { // We only intersect if we are inside a box around the center of 1/2 the // width (since a lot of the width is taken up by glow effects). int iSize = (m_iWidth / 4); return (Absolute(x) <= iSize && Absolute(y) <= iSize); }
dgFloat64 Determinant3x3 (const dgFloat64 matrix[3][3], dgFloat64* const error) { dgFloat64 sign = dgFloat64 (-1.0f); dgFloat64 det = dgFloat64 (0.0f); dgFloat64 accError = dgFloat64 (0.0f); for (dgInt32 i = 0; i < 3; i ++) { dgFloat64 cofactor[2][2]; for (dgInt32 j = 0; j < 2; j ++) { dgInt32 k0 = 0; for (dgInt32 k = 0; k < 3; k ++) { if (k != i) { cofactor[j][k0] = matrix[j][k]; k0 ++; } } } dgFloat64 parcialError; dgFloat64 minorDet = Determinant2x2 (cofactor, &parcialError); accError += parcialError * Absolute (matrix[2][i]); det += sign * minorDet * matrix[2][i]; sign *= dgFloat64 (-1.0f); } *error = accError; return det; }
void Apu3F() // CALL absolute { Absolute(); // 0xB6f for Star Fox 2 SPC700_PushW(IAPU.PC + 3 - IAPU.RAM); IAPU.PC = IAPU.RAM + IAPU.Address; }
void C_CPU::ASL_0E(WORD opcode)// absolute, 6 cycles { WORD memLoc = Absolute(6); WORD result = systemMem[memLoc]; // carry flag is bit 7 before shift if(result & 0x80) m_flagC = 1; else m_flagC = 0; // shift left result <<= 1; // if result is zero set the Z flag if(result == 0) m_flagZ = 1; else m_flagZ = 0; // set N flag if bit 7 is set if(result & 0x80) m_flagN = 1; else m_flagN = 0; //put result back in memory systemMem[memLoc] = result; }
void C_CPU::LSR_4E(WORD opcode)//absolute 6cycles { //carry flag is bit 0 before shift WORD memLoc = Absolute(6); WORD result = systemMem[memLoc]; if(result & 0x01) m_flagC = 1; else m_flagC = 0; // shift right result >>= 1; // if result is zero set the Z flag if(result == 0) m_flagZ = 1; else m_flagZ = 0; // this will never be set b/c bit 7 is always 0 after shift m_flagN = 0; //put result back in memory systemMem[memLoc] = result; }
hacd::HaF64 Determinant4x4 (const hacd::HaF64 matrix[4][4], hacd::HaF64* const error) { hacd::HaF64 sign = hacd::HaF64 (1.0f); hacd::HaF64 det = hacd::HaF64 (0.0f); hacd::HaF64 accError = hacd::HaF64 (0.0f); for (hacd::HaI32 i = 0; i < 4; i ++) { hacd::HaF64 cofactor[3][3]; for (hacd::HaI32 j = 0; j < 3; j ++) { hacd::HaI32 k0 = 0; for (hacd::HaI32 k = 0; k < 4; k ++) { if (k != i) { cofactor[j][k0] = matrix[j][k]; k0 ++; } } } hacd::HaF64 parcialError; hacd::HaF64 minorDet = Determinant3x3 (cofactor, &parcialError); accError += parcialError * Absolute (matrix[3][i]); det += sign * minorDet * matrix[3][i]; sign *= hacd::HaF64 (-1.0f); } *error = accError; return det; }
void Apu25() { // AND A,abs Absolute(); IAPU.YA.B.A &= S9xAPUGetByte(IAPU.Address); APUSetZN8(IAPU.YA.B.A); IAPU.PC += 3; }
void Apu65() { // CMP A,abs Absolute(); uint8 Work8 = S9xAPUGetByte(IAPU.Address); CMP(IAPU.YA.B.A, Work8); IAPU.PC += 3; }
void Apu5E() { // CMP Y,abs Absolute(); uint8 Work8 = S9xAPUGetByte(((IAPU.Address))); CMP(IAPU.YA.B.Y, Work8); IAPU.PC += 3; }
void Apu85() { // ADC A, abs Absolute(); uint8 Work8 = S9xAPUGetByte(((IAPU.Address))); ADC(IAPU.YA.B.A, Work8); IAPU.PC += 3; }
void Apu45() { // EOR A,abs Absolute(); IAPU.YA.B.A ^= S9xAPUGetByte(IAPU.Address); APUSetZN8(IAPU.YA.B.A); IAPU.PC += 3; }
void Apu05() { // OR A,abs Absolute(); IAPU.Registers.YA.B.A |= S9xAPUGetByte(IAPU.Address); APUSetZN8(IAPU.Registers.YA.B.A); IAPU.PC += 3; }
void Apu5E() { // CMP Y,abs Absolute(); uint8_t Work8 = S9xAPUGetByte(IAPU.Address); CMP(IAPU.Registers.YA.B.Y, Work8); IAPU.PC += 3; }
void Apu85() { // ADC A, abs Absolute(); uint8_t Work8 = S9xAPUGetByte(IAPU.Address); ADC(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 3; }
void Apu1E() { // CMP X,abs Absolute(); uint8_t Work8 = S9xAPUGetByte(IAPU.Address); CMP(IAPU.Registers.X, Work8); IAPU.PC += 3; }
void Apu2C() { // ROL abs Absolute(); uint8 Work8 = S9xAPUGetByte(((IAPU.Address))); ROL(Work8); S9xAPUSetByte(Work8, IAPU.Address); IAPU.PC += 3; }
void Apu6C() { // ROR abs Absolute(); uint8_t Work8 = S9xAPUGetByte(IAPU.Address); ROR(Work8); S9xAPUSetByte(Work8, IAPU.Address); IAPU.PC += 3; }
void Apu1F() { // JMP (abs+X) Absolute(); IAPU.PC = IAPU.RAM + S9xAPUGetByte(IAPU.Address + IAPU.Registers.X) + (S9xAPUGetByte(IAPU.Address + IAPU.Registers.X + 1) << 8); // XXX: HERE: // APU.Flags |= TRACE_FLAG; }
void Apu4C() { // LSR abs Absolute(); uint8 Work8 = S9xAPUGetByte(((IAPU.Address))); LSR(Work8); S9xAPUSetByte(Work8, IAPU.Address); IAPU.PC += 3; }
void Apu0C() { // ASL abs Absolute(); uint8_t Work8 = S9xAPUGetByte(IAPU.Address); ASL(Work8); S9xAPUSetByte(Work8, IAPU.Address); IAPU.PC += 3; }
void Apu0E() { // TSET1 abs Absolute(); uint8 Work8 = S9xAPUGetByte(IAPU.Address); S9xAPUSetByte(Work8 | IAPU.YA.B.A, IAPU.Address); Work8 &= IAPU.YA.B.A; APUSetZN8(Work8); IAPU.PC += 3; }
void Apu4E() { // TCLR1 abs Absolute(); uint8_t Work8 = S9xAPUGetByte(IAPU.Address); S9xAPUSetByte(Work8 & ~IAPU.Registers.YA.B.A, IAPU.Address); Work8 &= IAPU.Registers.YA.B.A; APUSetZN8(Work8); IAPU.PC += 3; }
void CGalacticMapSession::OnLButtonUp (int x, int y, DWORD dwFlags) // OnLButtonUp // // LButtonUp { if (m_bDragging) { int xNewPos, yNewPos; m_pPainter->ViewToGalactic(x, y, m_xAnchorCenter, m_yAnchorCenter, m_Scale.GetTargetScale(), &xNewPos, &yNewPos); // If we didn't drag very much, then clear the selection. if (Absolute(xNewPos - m_xAnchor) <= 2 && Absolute(yNewPos - m_yAnchor) <= 2) Select(NULL); m_bDragging = false; } }