Ejemplo n.º 1
0
void _KEY2::applySeed(u8 PROCNUM)
{
	u64 tmp = (MMU_read8(PROCNUM, REG_ENCSEED0H) & 0xFF);
	seed0 = MMU_read32(PROCNUM, REG_ENCSEED0L) | (tmp << 32);
	tmp = (MMU_read8(PROCNUM, REG_ENCSEED1H) & 0xFF);
	seed1 = MMU_read32(PROCNUM, REG_ENCSEED1L) | (tmp << 32);
	x = bitsReverse39(seed0);
	y = bitsReverse39(seed1);
	
	//printf("ARM%c: set KEY2 seed0 to %010llX (reverse %010llX)\n", PROCNUM?'7':'9', seed0, x);
	//printf("ARM%c: set KEY2 seed1 to %010llX (reverse %010llX)\n", PROCNUM?'7':'9', seed1, y);
}
Ejemplo n.º 2
0
void IdeasLog(armcpu_t* cpu)
{
	u32 adr = cpu->R[0];
	printf("EMULOG%c: ",cpu->proc_ID==0?'9':'7');
	for(;;) {
		u8 c = MMU_read8(cpu->proc_ID,adr);
		adr++;
		if(!c) break;
		printf("%c",c);
	}
	printf("\n");
}
Ejemplo n.º 3
0
void IORegView_Paint(CIORegView* wnd, HWND hWnd, WPARAM wParam, LPARAM lParam)
{
	HDC 			hDC; 
	PAINTSTRUCT 	ps;
	HDC 			hMemDC;
	HBITMAP			hMemBitmap;
	RECT			rc;
	HPEN 			pen;
	int				x, y, w, h;
	int				nameColWidth;
	int				curx, cury;
	SIZE			fontsize;
	IOReg			reg;
	char 			txt[80];

	GetClientRect(hWnd, &rc);
	x = 0;
	y = wnd->rebarHeight;
	w = rc.right - wnd->vsbWidth;
	h = rc.bottom - wnd->rebarHeight;
	curx = kXMargin; cury = wnd->yoff + kYMargin;

	hDC = BeginPaint(hWnd, &ps);

	hMemDC = CreateCompatibleDC(hDC);
	hMemBitmap = CreateCompatibleBitmap(hDC, w, h);
	SelectObject(hMemDC, hMemBitmap);

	pen = CreatePen(PS_SOLID, 1, RGB(210, 230, 255));
	SelectObject(hMemDC, pen);

	SelectObject(hMemDC, wnd->hFont);
	GetTextExtentPoint32(hMemDC, " ", 1, &fontsize);

	FillRect(hMemDC, &rc, (HBRUSH)GetStockObject(WHITE_BRUSH));

	reg = IORegs[wnd->CPU][wnd->Reg];
	if ((reg.type == AllRegs) || (reg.type == CatBegin))
	{
		nameColWidth = w - (kXMargin + (fontsize.cx*8) + kXMargin + 1 + kXMargin + kXMargin + 1 + kXMargin + (fontsize.cx*8) + kXMargin);

		DrawText(hMemDC, reg.name, curx, cury, w, fontsize.cy, DT_LEFT | DT_END_ELLIPSIS);
		cury += fontsize.cy + kYMargin;
		MoveToEx(hMemDC, 0, cury, NULL);
		LineTo(hMemDC, w, cury);
		cury ++;

		curx = kXMargin;
		DrawText(hMemDC, "Address", curx, cury+kYMargin, fontsize.cx*8, fontsize.cy, DT_LEFT);
		curx += (fontsize.cx*8) + kXMargin;
		MoveToEx(hMemDC, curx, cury, NULL);
		LineTo(hMemDC, curx, h);
		curx += 1 + kXMargin;
		DrawText(hMemDC, "Name", curx, cury+kYMargin, nameColWidth, fontsize.cy, DT_LEFT | DT_END_ELLIPSIS);
		curx += nameColWidth + kXMargin;
		MoveToEx(hMemDC, curx, cury, NULL);
		LineTo(hMemDC, curx, h);
		curx += 1 + kXMargin;
		DrawText(hMemDC, "Value", curx, cury+kYMargin, fontsize.cx*8, fontsize.cy, DT_RIGHT);

		cury += kYMargin + fontsize.cy + kYMargin;
		MoveToEx(hMemDC, 0, cury, NULL);
		LineTo(hMemDC, w, cury);
		cury += 1 + kYMargin;

		for (int i = wnd->Reg+1; ; i++)
		{
			IOReg curReg = IORegs[wnd->CPU][i];
			curx = kXMargin;

			if (curReg.type == CatBegin)
			{
				if (reg.type == AllRegs) continue;
				else break;
			}
			else if (curReg.type == ListEnd)
				break;
			else if (curReg.type == MMIOReg)
			{
				u32 val;

				sprintf(txt, "%08X", curReg.address);
				DrawText(hMemDC, txt, curx, cury, fontsize.cx*8, fontsize.cy, DT_LEFT);
				curx += (fontsize.cx*8) + kXMargin + 1 + kXMargin;

				DrawText(hMemDC, curReg.name, curx, cury, nameColWidth, fontsize.cy, DT_LEFT | DT_END_ELLIPSIS | DT_NOPREFIX);
				curx += nameColWidth + kXMargin + 1 + kXMargin;

				switch (curReg.size)
				{
				case 1:
					val = (u32)MMU_read8(wnd->CPU, curReg.address);
					sprintf(txt, "%02X", val);
					break;
				case 2:
					val = (u32)MMU_read16(wnd->CPU, curReg.address);
					sprintf(txt, "%04X", val);
					break;
				case 4:
					val = MMU_read32(wnd->CPU, curReg.address);
					sprintf(txt, "%08X", val);
					break;
				}
				DrawText(hMemDC, txt, curx, cury, fontsize.cx*8, fontsize.cy, DT_RIGHT);
			}

			cury += fontsize.cy + kYMargin;
			if (cury >= h) break;
			MoveToEx(hMemDC, 0, cury, NULL);
			LineTo(hMemDC, w, cury);
			cury += 1 + kYMargin;
		}
	}
	else
	{
		u32 val;
		nameColWidth = w - (kXMargin + (fontsize.cx*8) + kXMargin + 1 + kXMargin + kXMargin + 1 + kXMargin + (fontsize.cx*8) + kXMargin);

		sprintf(txt, "%08X - %s", reg.address, reg.name);
		DrawText(hMemDC, txt, curx, cury, w, fontsize.cy, DT_LEFT | DT_END_ELLIPSIS | DT_NOPREFIX);
		cury += fontsize.cy + kYMargin;
		MoveToEx(hMemDC, 0, cury, NULL);
		LineTo(hMemDC, w, cury);
		cury += 1 + kYMargin;

		switch (reg.size)
		{
		case 1:
			val = (u32)MMU_read8(wnd->CPU, reg.address);
			sprintf(txt, "Value:       %02X", val);
			break;
		case 2:
			val = (u32)MMU_read16(wnd->CPU, reg.address);
			sprintf(txt, "Value:     %04X", val);
			break;
		case 4:
			val = MMU_read32(wnd->CPU, reg.address);
			sprintf(txt, "Value: %08X", val);
			break;
		}
		DrawText(hMemDC, txt, curx, cury, w, fontsize.cy, DT_LEFT);
		cury += fontsize.cy + kYMargin;
		MoveToEx(hMemDC, 0, cury, NULL);
		LineTo(hMemDC, w, cury);
		cury ++;

		curx = kXMargin;
		DrawText(hMemDC, "Bits", curx, cury+kYMargin, fontsize.cx*8, fontsize.cy, DT_LEFT);
		curx += (fontsize.cx*8) + kXMargin;
		MoveToEx(hMemDC, curx, cury, NULL);
		LineTo(hMemDC, curx, h);
		curx += 1 + kXMargin;
		DrawText(hMemDC, "Description", curx, cury+kYMargin, nameColWidth, fontsize.cy, DT_LEFT | DT_END_ELLIPSIS);
		curx += nameColWidth + kXMargin;
		MoveToEx(hMemDC, curx, cury, NULL);
		LineTo(hMemDC, curx, h);
		curx += 1 + kXMargin;
		DrawText(hMemDC, "Value", curx, cury+kYMargin, fontsize.cx*8, fontsize.cy, DT_RIGHT);

		cury += kYMargin + fontsize.cy + kYMargin;
		MoveToEx(hMemDC, 0, cury, NULL);
		LineTo(hMemDC, w, cury);
		cury += 1 + kYMargin;

		for (int i = 0; i < reg.numBitfields; i++)
		{
			IORegBitfield bitfield = reg.bitfields[i];
			curx = kXMargin;

			if (bitfield.nbits > 1)
				sprintf(txt, "Bit%i-%i", bitfield.shift, bitfield.shift + bitfield.nbits - 1);
			else
				sprintf(txt, "Bit%i", bitfield.shift);
			DrawText(hMemDC, txt, curx, cury, fontsize.cx*8, fontsize.cy, DT_LEFT);
			curx += (fontsize.cx*8) + kXMargin + 1 + kXMargin;

			DrawText(hMemDC, bitfield.name, curx, cury, nameColWidth, fontsize.cy, DT_LEFT | DT_END_ELLIPSIS | DT_NOPREFIX);
			curx += nameColWidth + kXMargin + 1 + kXMargin;

			char bfpattern[8];
			sprintf(bfpattern, "%%0%iX", ((bitfield.nbits+3)&~3) >> 2);
			sprintf(txt, bfpattern, (val >> bitfield.shift) & ((1<<bitfield.nbits)-1));
			DrawText(hMemDC, txt, curx, cury, fontsize.cx*8, fontsize.cy, DT_RIGHT);

			cury += fontsize.cy + kYMargin;
			if (cury >= h) break;
			MoveToEx(hMemDC, 0, cury, NULL);
			LineTo(hMemDC, w, cury);
			cury += 1 + kYMargin;
		}
	}

	BitBlt(hDC, x, y, w, h, hMemDC, 0, 0, SRCCOPY);

	DeleteDC(hMemDC);
	DeleteObject(hMemBitmap);

	DeleteObject(pen);

	EndPaint(hWnd, &ps);
}