You've already forked OpenXeniumQPI
mirror of
https://github.com/Team-Resurgent/OpenXeniumQPI.git
synced 2026-04-30 10:17:24 -07:00
Xtools: Migrate to new XeniumTools
This commit is contained in:
+6
-6
@@ -1,7 +1,7 @@
|
||||
# Installation
|
||||
|
||||
## Program CPLD (If building it yourself)
|
||||
1. To program the CPLD see the `Firmware` page. Some programming notes are provided below:
|
||||
1. To program the CPLD see the [Firmware](./Firmware/README.md). page. Some programming notes are provided below:
|
||||
1.1 You will need a good quality JTAG programmer with the ability to parse`.svf` files. Some universal JTAG programming software is `OpenOCD` or `URJtag`. Check these for compatible programmers.
|
||||
1.2 The JTAG connection points are located along the edge of the OpenXenium PCB and are clearly labelled on the silkscreen.
|
||||
1.3 OpenXenium may require an external 3.3V power supply when programming. The RGB LED should be on when programming.
|
||||
@@ -9,13 +9,13 @@
|
||||
|
||||
## Programming XeniumOS to OpenXenium (If building it yourself)
|
||||
1. Confirm that the CPLD is programmed as per the above section.
|
||||
2. Boot your Xbox using another bootable modchip and transfer `xenium-tools.xbe` to your xbox. You must boot the Xbox using another modchip. Booting from the onboard TSOP will prevent xenium-tools from working.
|
||||
2. Boot your Xbox using another bootable modchip and transfer `default.xbe` from [Xenium-Tools repo](https://github.com/Ryzee119/Xenium-Tools/releases) to your xbox. You must boot the Xbox using another modchip. Booting from the onboard TSOP will prevent xenium-tools from working.
|
||||
3. Transfer over a xenium 2MB raw `flash.bin` **or** XeniumOS 2.3.1 `recovery.bin` (v2.3.1 only) to the xenium-tools directory. `flash.bin` is full Xenium flash memory dump obtained from a Genuine Xenium device using xenium-tools (Menu option START+X). This is the recommended file to use as it contains the recovery sector which allows the recovery feature to work on an OpenXenium.
|
||||
4. Open `xenium-tools.xbe`. The main menu looks like this <br> 
|
||||
4. Open the Xenium-Tools xbe. The main menu looks like this <br> <p align="center"><img src="./Images/xenium-tools_mainmenu.png" alt="xtools main menu" width="60%"/></p>
|
||||
5. At the main menu, carefully remove the current modchip and replace it with an OpenXenium. Hotswapping is not ideal and so great care should be taken to not drop anything into the Xbox and triple checking pin header alignment before commiting to pushing it onto the header.
|
||||
6. Press the BACK button to confirm that xenium-tools can now detect your OpenXenium. Also press A to toggle the RGB LED. This provides some confidence that the unit is functional. If this doesn't work, confirm you have programmed the CPLD with the OpenXenium firmware and you have installed it correctly on the header.
|
||||
7. Press START+B or START+Y to program `flash.bin` or `recovery.bin` respectively to the OpenXenium.
|
||||
8. On completion is should look like something like this <br> 
|
||||
6. Select `Rescan for Xenium` to confirm it can detect your OpenXenium. If this doesn't work, confirm you have programmed the CPLD with the OpenXenium firmware (RGB LED should default to red) and you have installed it correctly on the header.
|
||||
7. Selected `Write a Raw 2MB Flash Dump` or `Write XeniumOS 2.3.1 Update` accordingly.
|
||||
8. Confirm no errors are shown.
|
||||
|
||||
## OpenXenium Installation in Xbox
|
||||
1. The following steps assume you have an assembled OpenXenium and have programmed the CPLD and programmed XeniumOS as per the above sections.
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 50 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 39 KiB |
@@ -12,6 +12,8 @@ My own VHDL is probably quite similar to what Team Xodus produced for the Xenium
|
||||
|
||||
I do a quick run through of the build process here: https://youtu.be/P6YYViKby74
|
||||
|
||||
To manage your OpenXenium device's flash memory, the Xenium-Tools homebrew program has been moved [here](https://github.com/Ryzee119/Xenium-Tools).
|
||||
|
||||
## Supported Features
|
||||
The VHDL implements the following LPC transactions:
|
||||
* Memory Read/Writes (Translated to a parallel flash memory interface)
|
||||
@@ -32,15 +34,8 @@ When used with XeniumOS the VHDL in this repo supports the following features:
|
||||
* If you bridge the two recovery pins on power up, it will attempt to boot the XeniumOS recovery BIOS if available. This functions the same as a genuine Xenium modchip.
|
||||
* I also simulate the LFRAME abort mechanism (*Ref Intel LPC Interface Spec Rev 1.1 Section 4.3.1.13*) so that this will work on a v1.6 Original Xbox. This aborts the LPC transaction to prevent the Xyclops responding to the MCPX LPC Memory Read requests during boot (and conflicting with an external LPC memory peripheral). This is generally accepted to be better than shorting LFRAME the ground constantly which some traditional *Modchips* do.
|
||||
|
||||
## Folder Structure
|
||||
`Firmware` - Contains the VHDL and constraint files to synthesize the design using [Xilinx ISE Design Suite 14.7](https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/design-tools.html) to generate a JEDEC or SVF file for programming.
|
||||
`Hardware` - Contains the PCB Files (Created with [Autodesk Eagle](https://www.autodesk.com/products/eagle/overview)) and bill of materials information to build your own.
|
||||
`Xenium-Tools` - Contains a custom XBE (Created with [NXDK](https://github.com/XboxDev/nxdk)) to dump the flash contents of Xenium based devices, parse Xenium update files or write a raw flash dump to a OpenXenium/Genuine Xenium and some other Xenium related things.
|
||||
|
||||
## XeniumOS BIOS
|
||||
The final XeniumOS release supposedly contained no GPL code therefore was never open sourced and presumably never licensed for other hardware (clones). Consequently, although it is claimed to not contain any Microsoft code; **XeniumOS** is still property of Team Xodus, so I believe it cannot be included in this repo.
|
||||
|
||||
**The recommended way to get a copy of XeniumOS is to take a backup of your own Xenium modchip using `xenium-tools` provided in this repo.** It is also possible to parse the v2.3.1 XeniumOS update files released by Team Xodus to extract the neccessary data; however this will not contain the factory programmed recovery sector, but otherwise works in the same way.
|
||||
**The recommended way to get a copy of XeniumOS is to take a backup of your own Xenium modchip using [Xenium-Tools](https://github.com/Ryzee119/Xenium-Tools/releases).** It is also possible to parse the v2.3.1 XeniumOS update files released by Team Xodus to extract the neccessary data; however this will not contain the factory programmed recovery sector, but otherwise works in the same way.
|
||||
|
||||
This has been tested with XeniumOS 2.3.1 (Last release) and XeniumOS 2.3.1(Gold variant). The only way to obtain Gold OS is to dump the flash contents of your XeniumGold as the binary files were never distributed individually.
|
||||
|
||||
|
||||
@@ -1,339 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
@@ -1,5 +0,0 @@
|
||||
XBE_TITLE=xenium-tools
|
||||
GEN_XISO = $(XBE_TITLE).iso
|
||||
SRCS = $(wildcard $(CURDIR)/*.c)
|
||||
NXDK_SDL = y
|
||||
include $(NXDK_DIR)/Makefile
|
||||
@@ -1,23 +0,0 @@
|
||||
# Xenium-Tools XBE
|
||||

|
||||
## Features
|
||||
Xenium-Tools is a tool which allows various Xenium related things.
|
||||
* Dump the entire 2MB flash contents of a Xenium Device.
|
||||
* Write a raw 2MB flash dump to a Xenium Device. It must have the file name `flash.bin`.
|
||||
* Parse then write a XeniumOS update file. These are called `recovery.bin`. This feature only supports v2.3.1.
|
||||
* Toggle the RGB LED as a simple test.
|
||||
|
||||
Whilst these tools will work for a genuine Xenium and OpenXenium, it is only recommended to perform write commands to a Genuine only if it is non-functioning. This can bring back genuine Xeniums that have a corrupt flash for example.
|
||||
|
||||
## Limitations
|
||||
* Xenium-Tools does not check the validity of `flash.bin` or `recovery.bin` the user is responsible to ensure these are correct.
|
||||
* `recovery.bin` is the name of the update files released by Team Xodus. These are normally used with the recovery switch on the Xenium to update the OS. Xenium-Tools can parse and write v2.3.1 only. The only downside is that this file does not contain the recovery parition. So if you only use this to write to your OpenXenium the recovery feature will not work.
|
||||
* If writing a blank OpenXenium or attempting to repair a corrupt Genuine Xenium, you need to boot your Xbox with a working modchip to actually open this program. At which point you need to hotspot the modchip.
|
||||
|
||||
## Building
|
||||
* Install [NXDK](https://github.com/XboxDev/nxdk) and its dependencies.
|
||||
* Set NXDK_DIR path `export NXDK_DIR=/path/to/nxdk`
|
||||
* Compile xenium-tools using `make` from within the xenium-tools directory.
|
||||
* This will generate an xbe which you need to transfer to your Xbox.
|
||||
|
||||
By Ryzee119
|
||||
@@ -1,112 +0,0 @@
|
||||
/*
|
||||
* xenium-tools is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software has been developed using NXDK. The cross-platform, open-source SDK to develop for Original Xbox
|
||||
* See https://github.com/XboxDev/nxdk
|
||||
*/
|
||||
|
||||
#include "am29lv160mt.h"
|
||||
#include "xenium.h"
|
||||
|
||||
//The flash device used on Xenium and OpenXenium is a AM29LV160MT by Spansion (or equivalent).
|
||||
//These functions should be read in confunction with the relevant datasheet
|
||||
//https://www.dataman.com/media/datasheet/Spansion/AM29LV160M.pdf
|
||||
|
||||
//Memory calls in the range 0xFF000000 to 0xFFFFFFFF will be read from the LPC port flash rom
|
||||
//if enabled during boot. (D0 held low) Otherwise from the TSOP flash memory on the motherboard.
|
||||
//The CPLD on the Xenium will see these commands and read/write the flash chip as required.
|
||||
//http://xboxdevwiki.net/Memory
|
||||
static unsigned char LPCmemoryReadByte(unsigned long address){
|
||||
unsigned char* lpc_mem_map = (unsigned char *)LPCFlashAddress;
|
||||
return lpc_mem_map[address];
|
||||
}
|
||||
|
||||
//Two successive LPC reads. DQ6 will toggle if still in progress
|
||||
//Returns 1 if busy, 0 is not.
|
||||
static unsigned char flashBusy(){
|
||||
return (LPCmemoryReadByte(0x00)!=LPCmemoryReadByte(0x00));
|
||||
}
|
||||
|
||||
static void flashReset() {
|
||||
LPCmemoryWrite(0x000, 0xF0);
|
||||
}
|
||||
|
||||
void LPCmemoryRead(unsigned char* rxbuff, unsigned long address, unsigned long len){
|
||||
memcpy(rxbuff,(void*)(LPCFlashAddress + address), len);
|
||||
}
|
||||
|
||||
void LPCmemoryWrite(unsigned long address, unsigned char data) {
|
||||
memcpy((void*)(LPCFlashAddress + address),&data, 1);
|
||||
}
|
||||
|
||||
//Sector address should fall in the sector you want to erase.
|
||||
void flashSectorErase(unsigned long sector_address) {
|
||||
LPCmemoryWrite(0xAAA, 0xAA);
|
||||
LPCmemoryWrite(0x555, 0x55);
|
||||
LPCmemoryWrite(0xAAA, 0x80);
|
||||
LPCmemoryWrite(0xAAA, 0xAA);
|
||||
LPCmemoryWrite(0x555, 0x55);
|
||||
LPCmemoryWrite(sector_address, 0x30);
|
||||
while(flashBusy());
|
||||
}
|
||||
|
||||
void flashFullErase() {
|
||||
LPCmemoryWrite(0xAAA, 0xAA);
|
||||
LPCmemoryWrite(0x555, 0x55);
|
||||
LPCmemoryWrite(0xAAA, 0x80);
|
||||
LPCmemoryWrite(0xAAA, 0xAA);
|
||||
LPCmemoryWrite(0x555, 0x55);
|
||||
LPCmemoryWrite(0xAAA, 0x10);
|
||||
while(flashBusy()){
|
||||
Sleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
//Writes a single byte to a previously erased section.
|
||||
//This function can be sent in isolated provided the byte as already been erased.
|
||||
void flashProgramByte(unsigned long address, unsigned char data) {
|
||||
LPCmemoryWrite(0xAAA, 0xAA);
|
||||
LPCmemoryWrite(0x555, 0x55);
|
||||
LPCmemoryWrite(0xAAA, 0xA0);
|
||||
LPCmemoryWrite(address, data);
|
||||
while(flashBusy());
|
||||
}
|
||||
|
||||
unsigned char getManufID() {
|
||||
unsigned char manuf;
|
||||
LPCmemoryWrite(0xAAA, 0xAA);
|
||||
LPCmemoryWrite(0x555, 0x55);
|
||||
LPCmemoryWrite(0xAAA, 0x90);
|
||||
manuf = LPCmemoryReadByte(0x00);
|
||||
flashReset();
|
||||
return manuf;
|
||||
}
|
||||
|
||||
//Returns the deviceID of the flash memory chip
|
||||
//Some memory devices has the deviceID located
|
||||
//at address 1. So if the read fails I try at address 1 instead
|
||||
unsigned char getDevID() {
|
||||
unsigned char devID;
|
||||
LPCmemoryWrite(0xAAA, 0xAA);
|
||||
LPCmemoryWrite(0x555, 0x55);
|
||||
LPCmemoryWrite(0xAAA, 0x90);
|
||||
devID = LPCmemoryReadByte(0x02);
|
||||
flashReset();
|
||||
return devID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* xenium-tools is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software has been developed using NXDK. The cross-platform, open-source SDK to develop for Original Xbox
|
||||
* See https://github.com/XboxDev/nxdk
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <string.h>
|
||||
#include <hal/io.h>
|
||||
#include <hal/debug.h>
|
||||
|
||||
#define LPCFlashAddress 0xFF000000u
|
||||
|
||||
void LPCmemoryRead(unsigned char* rxbuff, unsigned long address, unsigned long len);
|
||||
void LPCmemoryWrite(unsigned long address, unsigned char data);
|
||||
void flashSectorErase(unsigned long sector_address);
|
||||
void flashFullErase(void);
|
||||
void flashProgramByte(unsigned long address, unsigned char data);
|
||||
unsigned char getManufID(void);
|
||||
unsigned char getDevID(void);
|
||||
Binary file not shown.
@@ -1,453 +0,0 @@
|
||||
/*
|
||||
* xenium-tools is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software has been developed using NXDK. The cross-platform, open-source SDK to develop for Original Xbox
|
||||
* See https://github.com/XboxDev/nxdk
|
||||
*/
|
||||
|
||||
#include <hal/debug.h>
|
||||
#include <pbkit/pbkit.h>
|
||||
#include <hal/video.h>
|
||||
#include <hal/xbox.h>
|
||||
#include <hal/input.h>
|
||||
#include <hal/io.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <windows.h>
|
||||
#include <SDL.h>
|
||||
|
||||
|
||||
|
||||
#include "main.h"
|
||||
#include "am29lv160mt.h"
|
||||
#include "xenium.h"
|
||||
|
||||
#define MAXRAM 0x03FFAFFF
|
||||
#define SCREEN_HEIGHT 480
|
||||
#define SCREEN_WIDTH 640
|
||||
|
||||
//From /hal/debug.c to modify position of cursor
|
||||
extern int nextRow;
|
||||
extern int nextCol;
|
||||
|
||||
//Get framebuffer pointer
|
||||
extern uint8_t* _fb;
|
||||
|
||||
SDL_GameController * gamepad;
|
||||
static unsigned char * flashData;
|
||||
static unsigned char * readBackBuffer;
|
||||
|
||||
int main() {
|
||||
|
||||
size_t fb_size = SCREEN_WIDTH * SCREEN_HEIGHT * sizeof(uint16_t);
|
||||
_fb = (uint8_t*)MmAllocateContiguousMemoryEx(fb_size,
|
||||
0,
|
||||
0xFFFFFFFF,
|
||||
0x1000,
|
||||
PAGE_READWRITE | PAGE_WRITECOMBINE);
|
||||
memset(_fb, 0x00, fb_size);
|
||||
|
||||
XVideoSetMode(SCREEN_WIDTH, SCREEN_HEIGHT, 16, REFRESH_DEFAULT);
|
||||
SDL_Init(SDL_INIT_GAMECONTROLLER);
|
||||
gamepad = SDL_GameControllerOpen(0);
|
||||
|
||||
flashData = MmAllocateContiguousMemoryEx(XENIUM_FLASH_SIZE, 0, MAXRAM,
|
||||
0, PAGE_READWRITE | PAGE_NOCACHE);
|
||||
readBackBuffer = MmAllocateContiguousMemoryEx(XENIUM_FLASH_SIZE, 0, MAXRAM,
|
||||
0, PAGE_READWRITE | PAGE_NOCACHE);
|
||||
|
||||
drawMainMenu();
|
||||
|
||||
//Record the bank used to get into this program. Useful when rebooting.
|
||||
//If not a valid bank, probably booted with a non Xenium device. In this case
|
||||
//just set it to Bank 1 - Cromwell bootloader for Xenium.
|
||||
unsigned char initialBiosBank = IoInputByte(0xEF) & 0x0F;
|
||||
if (initialBiosBank > 10 || initialBiosBank == 0) {
|
||||
initialBiosBank = XENIUM_BANK_CROMWELL;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
SDL_GameControllerUpdate();
|
||||
|
||||
/*DUMP XENIUM FLASH MEMORY*/
|
||||
if (getButton(gamepad, SDL_CONTROLLER_BUTTON_START) &&
|
||||
getButtonActivated(gamepad, SDL_CONTROLLER_BUTTON_X)) {
|
||||
|
||||
debugPrint("Dumping 2MB of the Xenium Flash memory\n");
|
||||
Sleep(1000);
|
||||
|
||||
if (checkForXenium() == 0) {
|
||||
debugPrint("Xenium device NOT detected! Something is wrong\n");
|
||||
} else {
|
||||
memset(flashData, 0x00, XENIUM_FLASH_SIZE);
|
||||
debugPrint("Dumping Xenium to 'flash.bin'...\n");
|
||||
dumpXenium(flashData);
|
||||
debugPrint("Read complete\n");
|
||||
|
||||
FILE * f0 = fopen("D:\\flash.bin", "wb");
|
||||
if (f0 == NULL) {
|
||||
debugPrint("Error creating file flash.bin. No files written\n");
|
||||
} else {
|
||||
debugPrint("Writing file... ");
|
||||
int chunkSize = 256;
|
||||
for (int i = 0; i < XENIUM_FLASH_SIZE; i += chunkSize) {
|
||||
fwrite(&flashData[i], 1, chunkSize, f0);
|
||||
fflush(f0);
|
||||
}
|
||||
fclose(f0);
|
||||
debugPrint("Dumping to flash.bin complete!\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
debugPrint("Press BACK to return to the main menu\n");
|
||||
waitForButton(gamepad, SDL_CONTROLLER_BUTTON_BACK);
|
||||
drawMainMenu();
|
||||
}
|
||||
|
||||
/* WRITE A RAW XENIUM FLASH DUMP TO FLASH MEMORY */
|
||||
else if (getButton(gamepad, SDL_CONTROLLER_BUTTON_START) &&
|
||||
getButtonActivated(gamepad, SDL_CONTROLLER_BUTTON_B)) {
|
||||
|
||||
debugPrint("Write a raw 2MB flash dump the Xenium device\n");
|
||||
debugPrint("DO NOT POWER OFF THE XBOX\n");
|
||||
FILE * f0 = fopen("D:\\flash.bin", "rb");
|
||||
|
||||
if (f0 == NULL) {
|
||||
debugPrint("flash.bin not found. Reboot Xbox and ensure\na 2MB flash.bin is located in the xbe directory.\n");
|
||||
} else if (checkForXenium() == 0) {
|
||||
debugPrint("Xenium device NOT detected! Something is wrong\n");
|
||||
} else {
|
||||
memset(flashData, 0x00, XENIUM_FLASH_SIZE);
|
||||
memset(readBackBuffer, 0x00, XENIUM_FLASH_SIZE);
|
||||
|
||||
debugPrint("Reading flash.bin\n");
|
||||
fread(flashData, 1, XENIUM_FLASH_SIZE, f0);
|
||||
fclose(f0);
|
||||
debugPrint("Ready to flash Xenium. Press BLACK to begin ERASE\n");
|
||||
waitForButton(gamepad, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER);
|
||||
debugPrint("Erasing... This can take up to 1 min\n");
|
||||
flashFullErase();
|
||||
writeXeniumRaw(flashData);
|
||||
debugPrint("Write Complete. Verifying\n");
|
||||
dumpXenium(readBackBuffer);
|
||||
|
||||
//Blank the write protected sector which is on a Genuine Xenium.
|
||||
//This will prevent verification errors on a Genuine xenium.
|
||||
memset(&readBackBuffer[0x1C0000], 0x00, 0x20000);
|
||||
memset(&flashData[0x1C0000], 0x00, 0x20000);
|
||||
if (memcmp(readBackBuffer, flashData, XENIUM_FLASH_SIZE) != 0) {
|
||||
debugPrint("ERROR VERIFYING DATA. Try again\n");
|
||||
} else {
|
||||
debugPrint("Verification Successful!!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (f0 != NULL) {
|
||||
fclose(f0);
|
||||
}
|
||||
|
||||
debugPrint("Press BACK to return to the main menu\n");
|
||||
waitForButton(gamepad, SDL_CONTROLLER_BUTTON_BACK);
|
||||
drawMainMenu();
|
||||
|
||||
}
|
||||
|
||||
/* PARSE AND WRITE A XOS UPDATE BINARY TO Xenium flash memory */
|
||||
else if (getButton(gamepad, SDL_CONTROLLER_BUTTON_START) &&
|
||||
getButtonActivated(gamepad, SDL_CONTROLLER_BUTTON_Y)) {
|
||||
|
||||
debugPrint("Write a Xos update file to the Xenium device\n");
|
||||
debugPrint("DO NOT POWER OFF THE XBOX\n");
|
||||
Sleep(1000);
|
||||
|
||||
FILE * f0 = fopen("D:\\recovery.bin", "rb");
|
||||
|
||||
if (f0 == NULL) {
|
||||
debugPrint("recovery.bin not found. Reboot Xbox and ensure\n");
|
||||
debugPrint("a 1MB recovery.bin is located in the xbe directory.\n");
|
||||
} else if (checkForXenium() == 0) {
|
||||
debugPrint("Xenium device NOT detected! Something is wrong\n");
|
||||
} else {
|
||||
memset(flashData, 0xFF, XENIUM_FLASH_SIZE);
|
||||
memset(readBackBuffer, 0x00, XENIUM_FLASH_SIZE);
|
||||
|
||||
debugPrint("Reading recovery.bin\n");
|
||||
fread(readBackBuffer, 1, XENIUM_SIZEOF_UPDATE, f0);
|
||||
fclose(f0);
|
||||
//CROMWELL LOADER - Exists at offset 0x00948 in recovery.bin
|
||||
memcpy(&flashData[0x180000], & readBackBuffer[0x00948], 0x40000);
|
||||
//XENIUMOS PART1 - Exists at offset 0x40948 in recovery.bin
|
||||
memcpy(&flashData[0x100000], & readBackBuffer[0x40948], 0x80000);
|
||||
//XENIUMOS PART2 - Exists at offset 0xE0948 in recovery.bin
|
||||
memcpy(&flashData[0x1E0000], & readBackBuffer[0xE0948], 0x20000);
|
||||
|
||||
debugPrint("Ready to flash Xenium. Press BLACK to begin ERASE\n");
|
||||
waitForButton(gamepad, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER);
|
||||
|
||||
debugPrint("Erasing... This can take up to 1 min\n");
|
||||
flashFullErase();
|
||||
writeXeniumRaw(flashData);
|
||||
debugPrint("Write Complete. Verifying\n");
|
||||
memset(readBackBuffer, 0x00, XENIUM_FLASH_SIZE);
|
||||
dumpXenium(readBackBuffer);
|
||||
|
||||
//Blank write protected sector. This will prevent verification errors on a real xenium.
|
||||
memset(&readBackBuffer[0x1C0000], 0x00, 0x20000);
|
||||
memset(&flashData[0x1C0000], 0x00, 0x20000);
|
||||
if (memcmp(readBackBuffer, flashData, XENIUM_FLASH_SIZE) != 0) {
|
||||
debugPrint("ERROR VERIFYING DATA. Try again\n");
|
||||
} else {
|
||||
debugPrint("Verification Successful!!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (f0 != NULL) {
|
||||
fclose(f0);
|
||||
}
|
||||
debugPrint("Press BACK to return to the main menu\n");
|
||||
waitForButton(gamepad, SDL_CONTROLLER_BUTTON_BACK);
|
||||
drawMainMenu();
|
||||
}
|
||||
|
||||
/* TOGGLE RGB LED ON EVERY PRESS OF A */
|
||||
else if (getButtonActivated(gamepad, SDL_CONTROLLER_BUTTON_A)) {
|
||||
static unsigned char ledcnt = 0;
|
||||
//Store current cursor position
|
||||
int row = nextRow;
|
||||
int col = nextCol;
|
||||
|
||||
IoOutputByte(XENIUM_REGISTER_LED, ledcnt);
|
||||
debugPrint("LED ");
|
||||
switch (ledcnt) {
|
||||
case 0:
|
||||
debugPrint("Off");
|
||||
break;
|
||||
case 1:
|
||||
debugPrint("Red");
|
||||
break;
|
||||
case 2:
|
||||
debugPrint("Green");
|
||||
break;
|
||||
case 3:
|
||||
debugPrint("Amber");
|
||||
break;
|
||||
case 4:
|
||||
debugPrint("Blue");
|
||||
break;
|
||||
case 5:
|
||||
debugPrint("Purple");
|
||||
break;
|
||||
case 6:
|
||||
debugPrint("Teal");
|
||||
break;
|
||||
case 7:
|
||||
debugPrint("White");
|
||||
break;
|
||||
}
|
||||
debugPrint(" ");
|
||||
|
||||
//Revert cursor back to original position
|
||||
nextRow = row;
|
||||
nextCol = col;
|
||||
|
||||
if (++ledcnt > 7) {
|
||||
ledcnt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* REBOOT XBOX NORMALLY */
|
||||
else if (getButton(gamepad, SDL_CONTROLLER_BUTTON_START) &&
|
||||
getButtonActivated(gamepad, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)) {
|
||||
|
||||
debugPrint("BLACK Pressed - Reboot Xbox\n");
|
||||
IoOutputByte(XENIUM_REGISTER_BANKING, initialBiosBank);
|
||||
Sleep(1000);
|
||||
break;
|
||||
}
|
||||
|
||||
//Recheck for Xenium device. Basically redraw the main menu
|
||||
else if (getButtonActivated(gamepad, SDL_CONTROLLER_BUTTON_BACK)) {
|
||||
|
||||
debugPrint("Checking for Xenium...\n");
|
||||
Sleep(500);
|
||||
drawMainMenu();
|
||||
}
|
||||
}
|
||||
|
||||
SDL_GameControllerClose(gamepad);
|
||||
pb_kill();
|
||||
XReboot();
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned char getButton(SDL_GameController * pad, SDL_GameControllerButton button) {
|
||||
return SDL_GameControllerGetButton(pad, button);
|
||||
}
|
||||
|
||||
void waitForButton(SDL_GameController * pad, SDL_GameControllerButton button) {
|
||||
do {
|
||||
SDL_GameControllerUpdate();
|
||||
Sleep(50);
|
||||
} while (getButton(pad, button) == 0);
|
||||
}
|
||||
|
||||
unsigned char getButtonActivated(SDL_GameController * pad, SDL_GameControllerButton button) {
|
||||
static unsigned short buttonState = 0x0000;
|
||||
unsigned char ret = 0;
|
||||
|
||||
//Exit on invalid inputs
|
||||
if (button == -1 || button >= 16) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Return 1 if button is pressed, and the buttonState was previously 0.
|
||||
if (SDL_GameControllerGetButton(pad, button)) {
|
||||
if (!(buttonState & (1 << (unsigned short) button))) {
|
||||
ret = 1;
|
||||
}
|
||||
buttonState |= 1 << (unsigned short) button; //Set buttonState
|
||||
} else {
|
||||
buttonState &= ~(1 << (unsigned short) button); //Clear buttonState
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void debugPrintXY(char * str, int x, int y) {
|
||||
int row = nextRow;
|
||||
int col = nextCol;
|
||||
nextCol = x;
|
||||
nextRow = y;
|
||||
debugPrint(str);
|
||||
nextRow = row;
|
||||
nextCol = col;
|
||||
}
|
||||
|
||||
void drawMainMenu(void) {
|
||||
debugClearScreen();
|
||||
debugPrint("Xenium Tools by Ryzee119\n");
|
||||
debugPrint("github.com/Ryzee119/OpenXenium\n");
|
||||
if (checkForXenium() == 1) {
|
||||
debugPrint("Xenium Detected!\n");
|
||||
} else {
|
||||
debugPrint("Xenium not Detected!\n");
|
||||
}
|
||||
debugPrint("______________________________________________________________\n");
|
||||
debugPrint("START+X: Dump full 2MB of Xenium Flash Memory\n");
|
||||
debugPrint("START+B: Write a raw 'flash.bin' to Xenium Flash Memory\n");
|
||||
debugPrint("START+Y: Write XOS 'recovery.bin' to Xenium Flash Memory\n");
|
||||
debugPrint("A: Cycle the RGB LED\n");
|
||||
debugPrint("BACK: Recheck for Xenium device\n");
|
||||
|
||||
debugPrint("START+BLACK: Reboot Xbox\n");
|
||||
debugPrint("______________________________________________________________\n");
|
||||
|
||||
debugPrintXY("Built with NXDK https://github.com/XboxDev/nxdk/", 25,
|
||||
SCREEN_HEIGHT - 50 - 16); //Screen height-margins-font height
|
||||
}
|
||||
|
||||
unsigned char checkForXenium() {
|
||||
unsigned char temp[8];
|
||||
unsigned char manuf, devid;
|
||||
|
||||
//A genuine xenium needs something similar to a real Xos boot process to start working
|
||||
//Must be something quirky in the CPLD. This seems to work:
|
||||
LPCmemoryRead(temp, 0x70, 8); //Couple reads just to get Xenium going
|
||||
IoOutputByte(XENIUM_REGISTER_BANKING, XENIUM_BANK_XENIUMOS);
|
||||
LPCmemoryRead(temp, 0x70, 8); //Couple reads just to get Xenium going
|
||||
IoOutputByte(XENIUM_REGISTER_BANKING, XENIUM_BANK_RECOVERY);
|
||||
LPCmemoryRead(temp, 0x70, 8); //Couple reads just to get Xenium going
|
||||
IoOutputByte(XENIUM_REGISTER_BANKING, XENIUM_BANK_CROMWELL);
|
||||
|
||||
manuf = getManufID();
|
||||
devid = getDevID();
|
||||
|
||||
//debugPrint("Man ID %02x, Dev ID %02x: ", manuf, devid);
|
||||
if (manuf == XENIUM_MANUF_ID && devid == XENIUM_DEVICE_ID){
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
char dumpXenium(unsigned char * buffer) {
|
||||
unsigned int address = 0;
|
||||
const unsigned short chunk_size = 128;
|
||||
|
||||
for (unsigned int rawAddress = 0; rawAddress < XENIUM_FLASH_SIZE; rawAddress += chunk_size) {
|
||||
if (rawAddress == 0x000000) {
|
||||
debugPrint("Reading .");
|
||||
IoOutputByte(XENIUM_REGISTER_BANKING, XENIUM_BANK_1_1024);
|
||||
address = 0;
|
||||
} else if (rawAddress == 0x100000) {
|
||||
debugPrint(".");
|
||||
IoOutputByte(XENIUM_REGISTER_BANKING, XENIUM_BANK_XENIUMOS);
|
||||
address = 0;
|
||||
} else if (rawAddress == 0x180000) {
|
||||
debugPrint(".");
|
||||
IoOutputByte(XENIUM_REGISTER_BANKING, XENIUM_BANK_CROMWELL);
|
||||
address = 0;
|
||||
} else if (rawAddress == 0x1C0000) {
|
||||
debugPrint(".\n");
|
||||
IoOutputByte(XENIUM_REGISTER_BANKING, XENIUM_BANK_RECOVERY);
|
||||
address = 0;
|
||||
}
|
||||
LPCmemoryRead( & buffer[rawAddress], address, chunk_size);
|
||||
address += chunk_size;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void writeXeniumRaw(unsigned char * buffer) {
|
||||
unsigned int bankSize = 0;
|
||||
|
||||
for (unsigned int rawAddress = 0; rawAddress < XENIUM_FLASH_SIZE; rawAddress += bankSize) {
|
||||
if (rawAddress == 0x000000) {
|
||||
debugPrint("Writing .");
|
||||
IoOutputByte(XENIUM_REGISTER_BANKING, XENIUM_BANK_1_1024);
|
||||
bankSize = 0x100000;
|
||||
|
||||
} else if (rawAddress == 0x100000) {
|
||||
debugPrint(".");
|
||||
IoOutputByte(XENIUM_REGISTER_BANKING, XENIUM_BANK_XENIUMOS);
|
||||
bankSize = 0x80000;
|
||||
|
||||
} else if (rawAddress == 0x180000) {
|
||||
debugPrint(".");
|
||||
IoOutputByte(XENIUM_REGISTER_BANKING, XENIUM_BANK_CROMWELL);
|
||||
bankSize = 0x40000;
|
||||
|
||||
} else if (rawAddress == 0x1C0000) {
|
||||
debugPrint(". ");
|
||||
IoOutputByte(XENIUM_REGISTER_BANKING, XENIUM_BANK_RECOVERY);
|
||||
bankSize = 0x40000;
|
||||
}
|
||||
|
||||
const unsigned int chunk = 1024;
|
||||
unsigned int bankAddress = 0;
|
||||
while (bankAddress < bankSize) {
|
||||
|
||||
for (unsigned int i = 0; i < chunk; i++) {
|
||||
flashProgramByte(bankAddress, buffer[rawAddress + bankAddress]);
|
||||
bankAddress++;
|
||||
}
|
||||
|
||||
//Calculate and display a percent complete.
|
||||
char str[] = "Complete: XXX%";
|
||||
sprintf(str, "Complete: %3u%%",
|
||||
(unsigned char)((float)(rawAddress + bankAddress) / (float) XENIUM_FLASH_SIZE * 100.0));
|
||||
debugPrintXY(str, 25, SCREEN_HEIGHT - 50 - 2 * 16); //Screen height-margins-2*font height
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
/*
|
||||
* xenium-tools is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software has been developed using NXDK. The cross-platform, open-source SDK to develop for Original Xbox
|
||||
* See https://github.com/XboxDev/nxdk
|
||||
*/
|
||||
|
||||
/*
|
||||
* Function: drawMainMenu
|
||||
* --------------------
|
||||
* Checks for Xenium compatible hardware and redraws the main menu
|
||||
* clearing any existing on screen text in the process
|
||||
*
|
||||
* returns: void
|
||||
*/
|
||||
void drawMainMenu(void);
|
||||
|
||||
/*
|
||||
* Function: getButton
|
||||
* --------------------
|
||||
* Checks if a button is currently being pressed.
|
||||
*
|
||||
* input1: Pointer to the SDL GameController handle
|
||||
* input2: SDL_GameControllerButton definition enum
|
||||
*
|
||||
* returns: 1 if button is being pressed. 0 otherwise.
|
||||
*/
|
||||
unsigned char getButton(SDL_GameController * , SDL_GameControllerButton);
|
||||
|
||||
/*
|
||||
* Function: getButton
|
||||
* --------------------
|
||||
* Spinlocks until the specified button is pressed.
|
||||
*
|
||||
* input1: Pointer to the SDL GameController handle
|
||||
* input2: SDL_GameControllerButton definition enum
|
||||
*
|
||||
* returns: void.
|
||||
*/
|
||||
void waitForButton(SDL_GameController * , SDL_GameControllerButton);
|
||||
|
||||
/*
|
||||
* Function: getButton
|
||||
* --------------------
|
||||
* Check if a button has just been actived (from 0 to 1)
|
||||
*
|
||||
* input1: Pointer to the SDL GameController handle
|
||||
* input2: SDL_GameControllerButton definition enum
|
||||
*
|
||||
* returns: 1 if the button has been and is being last call,
|
||||
* subsequent calls and calls when the button is NOT pressed will return 0
|
||||
*/
|
||||
unsigned char getButtonActivated(SDL_GameController * , SDL_GameControllerButton);
|
||||
|
||||
/*
|
||||
* Function: checkForXenium
|
||||
* --------------------
|
||||
* Checks the LPC port for Xenium compatible hardware.
|
||||
* this is achieved by reading the flashmemory device ID and
|
||||
* manufacturer ID and comparing them to known values.
|
||||
*
|
||||
* returns: 1 if Xenium compatible hardware is present. 0 otherwise.
|
||||
*/
|
||||
unsigned char checkForXenium(void);
|
||||
|
||||
/*
|
||||
* Function: dumpXenium
|
||||
* --------------------
|
||||
* Dumps the full 2MB flash contents of a Xenium compatible device
|
||||
* to an input buffer.
|
||||
* WARNING: The user must ensure sufficient memory is allocated for the buffer.
|
||||
*
|
||||
* input1: A pointer to an empty 2MB rx buffer
|
||||
*
|
||||
* returns: 0.
|
||||
*/
|
||||
char dumpXenium(unsigned char * );
|
||||
|
||||
/*
|
||||
* Function: writeXeniumRaw
|
||||
* --------------------
|
||||
* Writes a buffer to the 2MB flash contents of a Xenium compatible device
|
||||
* WARNING: The user must ensure sufficient memory is allocated for the buffer.
|
||||
*
|
||||
* input1: A pointer to a 2MB tx buffer containing data to write
|
||||
*
|
||||
* returns: void.
|
||||
*/
|
||||
void writeXeniumRaw(unsigned char * buffer);
|
||||
|
||||
/*
|
||||
* Function: writeXeniumRaw
|
||||
* --------------------
|
||||
* Prints a preformatted string to the screen using debugPrint() from hal/debug.h
|
||||
* to any X,Y position on the screen. The cursor position is returned to its previous
|
||||
* position after printing.
|
||||
*
|
||||
* input1: A pointer to a 2MB tx buffer containing data to write
|
||||
* input2: X position of the first character
|
||||
* input3: Y position of the first character
|
||||
*
|
||||
* returns: void.
|
||||
*/
|
||||
void debugPrintXY(char * str, int x, int y);
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* xenium-tools is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software has been developed using NXDK. The cross-platform, open-source SDK to develop for Original Xbox
|
||||
* See https://github.com/XboxDev/nxdk
|
||||
*/
|
||||
|
||||
#define XENIUM_REGISTER_BANKING 0xEF
|
||||
#define XENIUM_REGISTER_LED 0xEE
|
||||
#define XENIUM_LED_R (1<<0)
|
||||
#define XENIUM_LED_G (1<<1)
|
||||
#define XENIUM_LED_B (1<<2)
|
||||
|
||||
|
||||
#define XENIUM_BANK_TSOP 0
|
||||
#define XENIUM_BANK_CROMWELL 1
|
||||
#define XENIUM_BANK_XENIUMOS 2 //This is XeniumOS data only. To boot into XeniumOS, choose the cromwell bank.
|
||||
#define XENIUM_BANK_1 3
|
||||
#define XENIUM_BANK_2 4
|
||||
#define XENIUM_BANK_3 5
|
||||
#define XENIUM_BANK_4 6
|
||||
#define XENIUM_BANK_1_512 7
|
||||
#define XENIUM_BANK_2_512 8
|
||||
#define XENIUM_BANK_1_1024 9
|
||||
#define XENIUM_BANK_RECOVERY 10
|
||||
|
||||
#define XENIUM_FLASH_SIZE 2097152
|
||||
#define XENIUM_SIZEOF_CROMWELL 262144
|
||||
#define XENIUM_SIZEOF_XOS1 524288
|
||||
#define XENIUM_SIZEOF_XOS2 131072
|
||||
#define XENIUM_SIZEOF_UPDATE 1048576
|
||||
|
||||
#define XENIUM_MANUF_ID 0x01
|
||||
#define XENIUM_DEVICE_ID 0xC4
|
||||
Reference in New Issue
Block a user