Xbox 360: Workflow and maybe launcher works

This commit is contained in:
UnknownShadow200 2024-04-15 18:40:40 +10:00
parent 6b8c1c118b
commit c48188f215
3 changed files with 110 additions and 40 deletions

49
.github/workflows/build_xbox360.yml vendored Normal file
View File

@ -0,0 +1,49 @@
name: Build latest (Xbox 360)
on: [push]
concurrency:
group: ${{ github.ref }}-xbox360
cancel-in-progress: true
jobs:
build-Xbox:
if: github.ref_name == github.event.repository.default_branch
runs-on: ubuntu-latest
container:
image: free60/libxenon
steps:
- uses: actions/checkout@v3
- name: Compile 360 build
id: compile
run: |
export DEVKITXENON=/usr/local/xenon
export PATH=$PATH:$DEVKITXENON/bin:$DEVKITXENON/usr/bin
make xbox360
find .
# otherwise notify_failure doesn't work
- name: Install curl when necessary
if: ${{ always() && steps.compile.outcome == 'failure' }}
run: |
sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
apt-get update
apt-get install -y curl
- uses: ./.github/actions/notify_failure
if: ${{ always() && steps.compile.outcome == 'failure' }}
with:
NOTIFY_MESSAGE: 'Failed to compile Xbox 360 build'
WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'ClassiCube-xbox360.elf'
DEST_NAME: 'ClassiCube-xbox360.elf'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'ClassiCube-xbox360.elf32'
DEST_NAME: 'ClassiCube-xbox360.elf32'

View File

@ -303,13 +303,13 @@ void Gfx_CalcOrthoMatrix(struct Matrix* matrix, float width, float height, float
// TODO verify this
*matrix = Matrix_Identity;
matrix->row1.X = 2.0f / width;
matrix->row2.Y = -2.0f / height;
matrix->row3.Z = 1.0f / (zNear - zFar);
matrix->row1.x = 2.0f / width;
matrix->row2.y = -2.0f / height;
matrix->row3.z = 1.0f / (zNear - zFar);
matrix->row4.X = -1.0f;
matrix->row4.Y = 1.0f;
matrix->row4.Z = zNear / (zNear - zFar);
matrix->row4.x = -1.0f;
matrix->row4.y = 1.0f;
matrix->row4.z = zNear / (zNear - zFar);
}
static double Cotangent(double x) { return Math_Cos(x) / Math_Sin(x); }
@ -319,12 +319,12 @@ void Gfx_CalcPerspectiveMatrix(struct Matrix* matrix, float fov, float aspect, f
float c = (float)Cotangent(0.5f * fov);
*matrix = Matrix_Identity;
matrix->row1.X = c / aspect;
matrix->row2.Y = c;
matrix->row3.Z = zFar / (zNear - zFar);
matrix->row3.W = -1.0f;
matrix->row4.Z = (zNear * zFar) / (zNear - zFar);
matrix->row4.W = 0.0f;
matrix->row1.x = c / aspect;
matrix->row2.y = c;
matrix->row3.z = zFar / (zNear - zFar);
matrix->row3.w = -1.0f;
matrix->row4.z = (zNear * zFar) / (zNear - zFar);
matrix->row4.w = 0.0f;
}

View File

@ -10,34 +10,30 @@
#include "Bitmap.h"
#include "Errors.h"
#include "ExtMath.h"
#include "VirtualKeyboard.h"
#include <xenos/xenos.h>
#include <input/input.h>
#include <usb/usbmain.h>
#include <pci/io.h>
static cc_bool launcherMode;
struct _DisplayData DisplayInfo;
struct _WindowData WindowInfo;
// https://github.com/Free60Project/libxenon/blob/71a411cddfc26c9ccade08d054d87180c359797a/libxenon/drivers/console/console.c#L47
struct ati_info {
uint32_t unknown1[4];
uint32_t base;
uint32_t unknown2[8];
uint32_t width;
uint32_t height;
} __attribute__ ((__packed__)) ;
static uint32_t reg_read32(int reg)
{
return read32n(0xec800000 + reg);
}
void Window_Init(void) {
struct ati_info* ai = (struct ati_info*)0xec806100ULL;
DisplayInfo.Width = ai->width;
DisplayInfo.Height = ai->height;
DisplayInfo.Width = reg_read32(D1GRPH_X_END);
DisplayInfo.Height = reg_read32(D1GRPH_Y_END);
DisplayInfo.ScaleX = 1;
DisplayInfo.ScaleY = 1;
Window_Main.Width = ai->width;
Window_Main.Height = ai->height;
Window_Main.Width = DisplayInfo.Width;
Window_Main.Height = DisplayInfo.Height;
Window_Main.Focused = true;
Window_Main.Exists = true;
@ -128,17 +124,27 @@ void Window_AllocFramebuffer(struct Bitmap* bmp) {
}
void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
return;
//void* fb = XVideoGetFB();
//XVideoWaitForVBlank();
// https://github.com/Free60Project/libxenon/blob/master/libxenon/drivers/console/console.c#L166
// https://github.com/Free60Project/libxenon/blob/master/libxenon/drivers/console/console.c#L57
uint32_t* fb = (uint32_t*)(reg_read32(D1GRPH_PRIMARY_SURFACE_ADDRESS) | 0x80000000);
/* round up size to tiles of 32x32 */
int width = ((DisplayInfo.Width + 31) >> 5) << 5;
/*cc_uint32* src = (cc_uint32*)bmp->scan0 + r.X;
cc_uint32* dst = (cc_uint32*)fb + r.X;
#define FB_INDEX(x, y) (((y >> 5)*32*width + ((x >> 5)<<10) + (x&3) + ((y&1)<<2) + (((x&31)>>2)<<3) + (((y&31)>>1)<<6)) ^ ((y&8)<<2))
for (int y = r.Y; y < r.Y + r.height; y++)
for (int y = r.y; y < r.y + r.height; y++)
{
Mem_Copy(dst + y * bmp->width, src + y * bmp->width, r.width * 4);
}*/
cc_uint32* src = bmp->scan0 + y * bmp->width;
for (int x = r.x; x < r.x + r.width; x++) {
// TODO: Can the uint be copied directly ?
int R = BitmapCol_R(src[x]);
int G = BitmapCol_G(src[x]);
int B = BitmapCol_B(src[x]);
fb[FB_INDEX(x, y)] = (B << 24) | (G << 16) | (R << 8) | 0xFF;
}
}
}
void Window_FreeFramebuffer(struct Bitmap* bmp) {
@ -149,11 +155,26 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
/*########################################################################################################################*
*------------------------------------------------------Soft keyboard------------------------------------------------------*
*#########################################################################################################################*/
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { }
void OnscreenKeyboard_SetText(const cc_string* text) { }
void OnscreenKeyboard_Draw2D(Rect2D* r, struct Bitmap* bmp) { }
void OnscreenKeyboard_Draw3D(void) { }
void OnscreenKeyboard_Close(void) { /* TODO implement */ }
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
if (Input.Sources & INPUT_SOURCE_NORMAL) return;
VirtualKeyboard_Open(args, launcherMode);
}
void OnscreenKeyboard_SetText(const cc_string* text) {
VirtualKeyboard_SetText(text);
}
void OnscreenKeyboard_Draw2D(Rect2D* r, struct Bitmap* bmp) {
VirtualKeyboard_Display2D(r, bmp);
}
void OnscreenKeyboard_Draw3D(void) {
VirtualKeyboard_Display3D();
}
void OnscreenKeyboard_Close(void) {
VirtualKeyboard_Close();
}
/*########################################################################################################################*