Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

v1

  • Loading branch information...
commit e086f7dc47bd79fc05af19fc1c3a2006f31ab695 1 parent 56f298d
@euss authored
Showing with 4,642 additions and 0 deletions.
  1. +1 −0  AUTHORS
  2. +37 −0 AppMain.tcl
  3. +674 −0 COPYING
  4. +21 −0 CREDITS
  5. +12 −0 FIRMWARE
  6. +71 −0 README
  7. +199 −0 console.tcl
  8. BIN  images/ps3mfw-icon-128.gif
  9. BIN  images/ps3mfw-icon-128.png
  10. BIN  images/ps3mfw-icon-32.gif
  11. BIN  images/ps3mfw-icon-32.png
  12. BIN  images/ps3mfw-icon.ico
  13. +200 −0 ps3mfw
  14. BIN  ps3mfw.exe
  15. +495 −0 ps3mfw_base.tcl
  16. +563 −0 ps3mfw_gui.tcl
  17. +137 −0 ps3mfw_tasks.tcl
  18. +328 −0 scrolledframe.tcl
  19. +310 −0 tar.tcl
  20. +112 −0 tasks/README
  21. +127 −0 tasks/add_license_msg.tcl
  22. +58 −0 tasks/clean_friends.tcl
  23. +68 −0 tasks/clean_game.tcl
  24. +48 −0 tasks/clean_music.tcl
  25. +67 −0 tasks/clean_network.tcl
  26. +53 −0 tasks/clean_photo.tcl
  27. +53 −0 tasks/clean_psn.tcl
  28. +63 −0 tasks/clean_video.tcl
  29. +79 −0 tasks/patch_category_game.tcl
  30. +47 −0 tasks/patch_lv1.tcl
  31. +63 −0 tasks/patch_lv2.tcl
  32. +61 −0 tasks/patch_nas_plugin.tcl
  33. +53 −0 tasks/patch_vsh.tcl
  34. BIN  tools/cospkg.exe
  35. BIN  tools/cosunpkg.exe
  36. BIN  tools/cyggcc_s-1.dll
  37. BIN  tools/cygwin1.dll
  38. BIN  tools/cygz.dll
  39. BIN  tools/makepkg.exe
  40. BIN  tools/makeself.exe
  41. BIN  tools/norunpack.exe
  42. BIN  tools/pkg.exe
  43. BIN  tools/puppack.exe
  44. BIN  tools/pupunpack.exe
  45. BIN  tools/readself.exe
  46. BIN  tools/readself2.exe
  47. BIN  tools/sceverify.exe
  48. BIN  tools/self_rebuilder.exe
  49. BIN  tools/unpkg.exe
  50. BIN  tools/unself.exe
  51. BIN  tools/unspp.exe
  52. +282 −0 tracedtext.tcl
  53. +360 −0 xml.tcl
View
1  AUTHORS
@@ -0,0 +1 @@
+Anonymous Developers (Code Monkeys)
View
37 AppMain.tcl
@@ -0,0 +1,37 @@
+#!/usr/bin/env wish8.5
+#
+# ps3mfw -- PS3 MFW creator
+#
+# Copyright (C) Anonymous Developers (Code Monkeys)
+#
+# This software is distributed under the terms of the GNU General Public
+# License ("GPL") version 3, as published by the Free Software Foundation.
+#
+
+# MacOS X / Windows wrapper
+#
+# Mac OSX: Remove Cocoa argument from arglist
+if {[string first "-psn" [lindex $argv 0]] == 0} { set argv [lrange $argv 1 end]}
+
+#Source the main file
+if { $::tcl_platform(platform) == "windows"} {
+ source [file join [pwd] ps3mfw]
+} else {
+ #Set variable program_dir
+ set program_dir [file dirname [info script]]
+ set program [file tail [info script]]
+
+ while {[catch {file readlink [file join $program_dir $program]} program]== 0} {
+ if {[file pathtype $program] == "absolute"} {
+ set program_dir [file dirname $program]
+ } else {
+ set program_dir [file join $program_dir [file dirname $program]]
+ }
+
+ set program [file tail $program]
+ }
+
+ unset program
+ source [file join $program_dir ps3mfw]
+}
+
View
674 COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. 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
+them 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 prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. 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.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey 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;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If 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 convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU 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 that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ 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.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+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.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ 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
+state 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 3 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 <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program 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, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU 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. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
View
21 CREDITS
@@ -0,0 +1,21 @@
+DEVELOPED BY:
+Anonymous Developers (Code Monkeys)
+
+SPECIAL THANKS TO:
+Phineus
+anonymous developer - (self_rebuilder)
+evilsperm
+jbc
+grafchokolo (LV1 Patch)
+PL3 and its contributors (LV2/vsh/nas_plugin patches)
+fail0verflow team
+
+TESTERS:
+jbc
+King "The Man" Dong
+CrackKillsDreams
+drizztbsd
+CrashSerious
+kmeaw
+a few other anonymous testers.
+
View
12 FIRMWARE
@@ -0,0 +1,12 @@
+3.15 PS3UPDAT.PUP
+MD5::54ee80e14e479f8351a988eb9a472072
+SHA1::fc4e891e84333f9b37ff7f253eca165aa416c6ad
+
+3.41 PS3UPDAT.PUP
+MD5::e07d2b84c9e9691c261b73e5f1aada20
+SHA1::e7f522ba85c8fc780b8bcbaff6c70d36487e2e45
+
+3.55 PS3UPDAT.PUP
+MD5::ca595ad9f3af8f1491d9c9b6921a8c61
+SHA1::a3a0d1c61e17c6a58a5fa247a3dbb51524329e0a
+
View
71 README
@@ -0,0 +1,71 @@
+
+==============================================================
+ .------. .-------. .-----. .. .-. .--------. .--.
+ /_____ \/ _____//_____ \ / \/ \ /_ _____/\ / /
+ / ____/\____ \ __(__ < / \ / __)\ \/\/ /
+ / / / \/ \ /\/\ Y / \ /
+/___/ /________/_________/__/ \___|__/ \__/\__/
+ PS3MFW Builder v0.1
+==============================================================
+
+------------
+INTRODUCTION
+------------
+
+For years, the security system of PS3 remained unbreached because Sony had a
+very good defense mechanism: Consumers could use it for more than just gaming
+by installing Linux via the "Other OS" feature. Therefore there was little
+motivation for security researchers to investigate the PS3. However, then Sony
+(or SCE, SCEA, SCEE or whatever, we aren't exactly sure what is going on there
+anymore) made an unprecedented move: Not only did they introduce a new PS3
+model that no longer allowed the installation of an Other OS, but with a
+firmware "upgrade" they removed the capability from previously sold consoles.
+While removing advertised features from a product (several years after its
+purchase!) is blatantly unlawful, having highly paid lawyers apparently allows
+you to get away with it- in a legal sense.
+
+
+But when the law fails to protect the people, then some of those people, being
+clever and resourceful, help themselves. And that is what happened here. Sony
+sunk its own battleship.
+
+PS3MFW is the next step in the process of returning to consumers control over
+their own hardware. Your PS3 belongs to you. You didn't lease it, and you
+signed no contract when you purchased it. It is your right to use it however
+you choose. It is your responsibility to do so within the legal boundaries.
+
+PS3MFW allows you to tailor your PS3's firmware to your specific needs, giving
+you a level of control you previously lacked. PS3MFW is open source. That
+means it is completely transparent, and anyone with the necessary programming
+knowledge can help to improve it and create new plugin tasks.
+
+It is with great pleasure and joy that we are now able to present you with the
+first public release of PS3MFW Builder. A lot of hard work went into this
+during the past five weeks, by some incredibly dedicated and inspired people.
+We would like to thank everyone who contributed, the people who got this
+project underway, and those who did all the programming and testing.
+
+PS3MFW Builder v0.1 has been successfully tested on all major PS3 hardware
+revisions, and in conjunction with OFW 3.10 - 3.55. It is NOT compatible with
+OFW 3.56.
+
+Remember that this is only the very first release of PS3MFW Builder, version
+0.1. With your support and feedback, we intend to create the definitive PS3
+firmware solution that makes all other closed-source custom firmwares obsolete.
+
+PS3MFW Builder is not distributed with any program code copyrighted by third
+parties.
+
+PS.
+KevinButler, you sunk your own battleship.
+
+------------
+REQUIREMENTS
+------------
+
+To use PS3MFW Builder, the following is needed:
+
+-The latest version of the f0 tools
+
+-Tcl/Tk 8.5 ( http://www.tcl.tk/software/tcltk/8.5.tml )
+
View
199 console.tcl
@@ -0,0 +1,199 @@
+# FILE: console.tcl
+ #
+ # Provides a console window.
+ #
+ # Last modified on: $Date: 2006-01-28 17:42:17 -0500 (Sat, 28 Jan 2006) $
+ # Last modified by: $Author: redacted $
+ #
+ # This file is evaluated to provide a console window interface to the
+ # root Tcl interpreter of an OOMMF application. It calls on a script
+ # included with the Tk script library to do most of the work, making use
+ # of Tk interface details which are only semi-public. For this reason,
+ # there is some risk that future versions of Tk will no longer support
+ # this script. That is why this script has been isolated in a file of
+ # its own.
+
+ ########################################################################
+ # If the Tcl command 'console' is already in the interpreter, our work
+ # is done.
+ ########################################################################
+ if {![catch {console show}]} {
+ return
+ }
+
+ ########################################################################
+ # Check Tcl/Tk support
+ ########################################################################
+ if {[catch {package require Tcl 8}]} {
+ package require Tcl 7.5
+ }
+
+ if {[catch {package require Tk 8}]} {
+ if {[catch {package require Tk 4.1}]} {
+ return -code error "Tk required but not loaded."
+ }
+ }
+
+ set _ [file join $tk_library console.tcl]
+ if {![file readable $_]} {
+ return -code error "File not readable: $_"
+ }
+
+ ########################################################################
+ # Provide the support which the Tk library script console.tcl assumes
+ ########################################################################
+ # 1. Create an interpreter for the console window widget and load Tk
+ set consoleInterp [interp create]
+ $consoleInterp eval [list set tk_library $tk_library]
+ $consoleInterp alias exit exit
+ load "" Tk $consoleInterp
+
+ # 2. A command 'console' in the application interpreter
+ ;proc console {sub {optarg {}}} [subst -nocommands {
+ switch -exact -- \$sub {
+ title {
+ $consoleInterp eval wm title . [list \$optarg]
+ }
+ hide {
+ $consoleInterp eval wm withdraw .
+ }
+ show {
+ $consoleInterp eval wm deiconify .
+ }
+ eval {
+ $consoleInterp eval \$optarg
+ }
+ default {
+ error "bad option \\\"\$sub\\\": should be hide, show, or title"
+ }
+ }
+ }]
+
+ # 3. Alias a command 'consoleinterp' in the console window interpreter
+ # to cause evaluation of the command 'consoleinterp' in the
+ # application interpreter.
+ ;proc consoleinterp {sub cmd} {
+ switch -exact -- $sub {
+ eval {
+ uplevel #0 $cmd
+ }
+ record {
+ history add $cmd
+ catch {uplevel #0 $cmd} retval
+ return $retval
+ }
+ default {
+ error "bad option \"$sub\": should be eval or record"
+ }
+ }
+ }
+ if {[package vsatisfies [package provide Tk] 4]} {
+ $consoleInterp alias interp consoleinterp
+ } else {
+ $consoleInterp alias consoleinterp consoleinterp
+ }
+
+ # 4. Bind the <Destroy> event of the application interpreter's main
+ # window to kill the console (via tkConsoleExit)
+ bind . <Destroy> [list +if {[string match . %W]} [list catch \
+ [list $consoleInterp eval tkConsoleExit]]]
+
+ # 5. Redefine the Tcl command 'puts' in the application interpreter
+ # so that messages to stdout and stderr appear in the console.
+ rename puts tcl_puts
+ ;proc puts {args} [subst -nocommands {
+ switch -exact -- [llength \$args] {
+ 1 {
+ if {[string match -nonewline \$args]} {
+ if {[catch {uplevel 1 [linsert \$args 0 tcl_puts]} msg]} {
+ regsub -all tcl_puts \$msg puts msg
+ return -code error \$msg
+ }
+ } else {
+ $consoleInterp eval [list tkConsoleOutput stdout \
+ "[lindex \$args 0]\n"]
+ }
+ }
+ 2 {
+ if {[string match -nonewline [lindex \$args 0]]} {
+ $consoleInterp eval [list tkConsoleOutput stdout \
+ [lindex \$args 1]]
+ } elseif {[string match stdout [lindex \$args 0]]} {
+ $consoleInterp eval [list tkConsoleOutput stdout \
+ "[lindex \$args 1]\n"]
+ } elseif {[string match stderr [lindex \$args 0]]} {
+ $consoleInterp eval [list tkConsoleOutput stderr \
+ "[lindex \$args 1]\n"]
+ } else {
+ if {[catch {uplevel 1 [linsert \$args 0 tcl_puts]} msg]} {
+ regsub -all tcl_puts \$msg puts msg
+ return -code error \$msg
+ }
+ }
+ }
+ 3 {
+ if {![string match -nonewline [lindex \$args 0]]} {
+ if {[catch {uplevel 1 [linsert \$args 0 tcl_puts]} msg]} {
+ regsub -all tcl_puts \$msg puts msg
+ return -code error \$msg
+ }
+ } elseif {[string match stdout [lindex \$args 1]]} {
+ $consoleInterp eval [list tkConsoleOutput stdout \
+ [lindex \$args 2]]
+ } elseif {[string match stderr [lindex \$args 1]]} {
+ $consoleInterp eval [list tkConsoleOutput stderr \
+ [lindex \$args 2]]
+ } else {
+ if {[catch {uplevel 1 [linsert \$args 0 tcl_puts]} msg]} {
+ regsub -all tcl_puts \$msg puts msg
+ return -code error \$msg
+ }
+ }
+ }
+ default {
+ if {[catch {uplevel 1 [linsert \$args 0 tcl_puts]} msg]} {
+ regsub -all tcl_puts \$msg puts msg
+ return -code error \$msg
+ }
+ }
+ }
+ }]
+ $consoleInterp alias puts puts
+
+ # 6. No matter what Tk_Main says, insist that this is an interactive shell
+ set tcl_interactive 1
+
+ ########################################################################
+ # Evaluate the Tk library script console.tcl in the console interpreter
+ ########################################################################
+ $consoleInterp eval source [list [file join $tk_library console.tcl]]
+ $consoleInterp eval {
+ if {![llength [info commands tkConsoleExit]]} {
+ tk::unsupported::ExposePrivateCommand tkConsoleExit
+ }
+ }
+ $consoleInterp eval {
+ if {![llength [info commands tkConsoleOutput]]} {
+ tk::unsupported::ExposePrivateCommand tkConsoleOutput
+ }
+ }
+ if {[string match 8.3.4 $tk_patchLevel]} {
+ # Workaround bug in first draft of the tkcon enhancments
+ $consoleInterp eval {
+ bind Console <Control-Key-v> {}
+ }
+ }
+ # Restore normal [puts] if console widget goes away...
+ proc Oc_RestorePuts {slave} {
+ rename puts {}
+ rename tcl_puts puts
+ interp delete $slave
+ }
+ $consoleInterp alias Oc_RestorePuts Oc_RestorePuts $consoleInterp
+ $consoleInterp eval {
+ bind Console <Destroy> +Oc_RestorePuts
+ }
+
+ unset consoleInterp
+
+ console title "[wm title .] Console"
View
BIN  images/ps3mfw-icon-128.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  images/ps3mfw-icon-128.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  images/ps3mfw-icon-32.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  images/ps3mfw-icon-32.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  images/ps3mfw-icon.ico
Binary file not shown
View
200 ps3mfw
@@ -0,0 +1,200 @@
+#!/usr/bin/env tclsh8.5
+#
+# ps3mfw -- PS3 MFW creator
+#
+# Copyright (C) Anonymous Developers (Code Monkeys)
+#
+# This software is distributed under the terms of the GNU General Public
+# License ("GPL") version 3, as published by the Free Software Foundation.
+#
+
+set ::PS3MFW_VERSION "0.1"
+
+# Option --debug: Show verbose debugging information
+# Option --silent: Disable log output
+# Option --custom-pup-version: Custom PUP build version
+# Option --custom-version-string: If set, overrides the entire PUP version string
+# Option --version-prefix: Prefix to add to the PUP version string
+# Option --version-suffix: Suffix to add to the PUP version string
+# Option --build-dir: Build directory for temporary files
+# Option --gui: Launch the Graphical User Interface
+array set options {
+ --debug false
+ --silent false
+ --custom-pup-version ""
+ --custom-version-string ""
+ --version-prefix ""
+ --version-suffix "-PS3MFW"
+ --build-dir ""
+ --gui true
+}
+
+
+#
+# End of configuration section.
+#
+
+set PUP "pup"
+set PUPPACK "puppack"
+set PUPUNPACK "pupunpack"
+set COSPKG "cospkg"
+set COSUNPKG "cosunpkg"
+set PKG "pkg"
+set UNPKG "unpkg"
+set UNSELF "unself"
+set MAKESELF "self_rebuilder"
+
+set PS3MFW_DIR [file dirname [info script]]
+set program [file tail [info script]]
+
+while {[catch {file readlink [file join $PS3MFW_DIR $program]} program] == 0} {
+ if {[file pathtype $program] == "absolute"} {
+ set PS3MFW_DIR [file dirname $program]
+ } else {
+ set PS3MFW_DIR [file join $PS3MFW_DIR [file dirname $program]]
+ }
+
+ set program [file tail $program]
+}
+
+set ::auto_path [linsert $::auto_path 0 $PS3MFW_DIR]
+if { $::tcl_platform(platform) == "windows"} {
+ append ::env(PATH) ";[file nativename [file join $PS3MFW_DIR tools]]"
+} else {
+ append ::env(PATH) ":[file join $PS3MFW_DIR tools]"
+}
+
+source [file join $PS3MFW_DIR xml.tcl]
+source [file join $PS3MFW_DIR tar.tcl]
+source [file join $PS3MFW_DIR ps3mfw_base.tcl]
+source [file join $PS3MFW_DIR ps3mfw_tasks.tcl]
+
+set TASKS_DIR [file join $PS3MFW_DIR tasks]
+
+set taskfiles [get_sorted_task_files]
+set tasks [list]
+set taskname ""
+set arguments [list]
+set current_opt ""
+set current_task_opt ""
+
+foreach taskfile $taskfiles {
+ source $taskfile
+}
+
+foreach arg $argv {
+ if {$current_opt != ""} {
+ if {![string match "--*" $arg]} {
+ set ::options($current_opt) $arg
+ set current_opt ""
+ } else {
+ usage "Invalid option: $arg, expected value.\n"
+ }
+ } elseif {$current_task_opt != ""} {
+ if {![string match "--*" $arg]} {
+ set ::${taskname}::options($current_task_opt) $arg
+ set current_task_opt ""
+ } else {
+ usage "Invalid option: $arg, expected value.\n"
+ }
+ } else {
+ if {[string match "--*" $arg]} {
+ if {[info exists ::options($arg)]} {
+ set current_opt $arg
+ } else {
+ set task [string map {- _} [string range $arg 2 end]]
+ if {[namespace exists ${task}]} {
+ lappend tasks "$task"
+ set taskname $task
+ } elseif {[info exists ::${taskname}::options($arg)]} {
+ set current_task_opt $arg
+ } else {
+ usage "Invalid option: $arg, expected task.\n"
+ }
+ }
+ } else {
+ lappend arguments $arg
+ }
+ }
+}
+
+if {$current_opt != ""} {
+ usage "Option $current_opt needs a value\n"
+} elseif {$current_task_opt != ""} {
+ usage "Option $current_task_opt needs a value\n"
+}
+
+if {[llength $tasks] == 0 } {
+ set tasks [list patch_category_game patch_lv1 patch_lv2 patch_nas_plugin patch_vsh add_license_msg]
+ foreach task $tasks {
+ source [file join $TASKS_DIR $task.tcl]
+ }
+}
+
+if {$::options(--build-dir) != ""} {
+ set ::BUILD_DIR $::options(--build-dir)
+} else {
+ if { $::tcl_platform(platform) == "windows" && [info exists ::env(TEMP)]} {
+ set BUILD_DIR [file join $::env(TEMP) PS3MFW]
+ if {[catch {file mkdir $BUILD_DIR}]} {
+ set BUILD_DIR [pwd]
+ }
+ } elseif {$::tcl_platform(platform) == "unix"} {
+ set BUILD_DIR [file join /tmp PS3MFW]
+ if {[catch {file mkdir $BUILD_DIR}]} {
+ set BUILD_DIR [pwd]
+ }
+ } else {
+ set BUILD_DIR [pwd]
+ }
+}
+unset ::options(--build-dir)
+
+set ORIGINAL_PUP_DIR [file join ${BUILD_DIR} PS3MFW-OFW]
+set CUSTOM_PUP_DIR [file join ${BUILD_DIR} PS3MFW-MFW]
+set LOG_FILE [file join ${BUILD_DIR} "[file rootname [file tail $argv0]].log"]
+
+# update base files
+set CUSTOM_VERSION_TXT [file join ${CUSTOM_PUP_DIR} version.txt]
+set CUSTOM_LICENSE_XML [file join ${CUSTOM_PUP_DIR} license.xml]
+set CUSTOM_UPDATE_FLAGS [file join ${CUSTOM_PUP_DIR} update_flags.txt]
+set CUSTOM_PS3SWU_SELF [file join ${CUSTOM_PUP_DIR} ps3swu.self]
+set CUSTOM_UPDATE_TAR [file join ${CUSTOM_PUP_DIR} update_files.tar]
+set CUSTOM_UPDATE_DIR [file join ${CUSTOM_PUP_DIR} update_files]
+
+# update_files.tar pkg files
+set CUSTOM_DEVFLASH_DIR [file join ${CUSTOM_UPDATE_DIR} dev_flash]
+set CUSTOM_UPLXML_DIR [file join ${CUSTOM_UPDATE_DIR} UPL.xml]
+
+# modification files
+set CUSTOM_UPL_XML [file join ${CUSTOM_UPLXML_DIR} UPL.xml]
+
+if {$options(--gui)} {
+ package require Tk 8.5
+ foreach font [font names] {
+ font configure $font -family Helvetica
+ }
+ if { [info proc console] == "" && [info command console] == "" } {
+ source [file join $PS3MFW_DIR console.tcl]
+ console hide
+ }
+ if {$::options(--debug)} {
+ console show
+ }
+
+ source [file join $PS3MFW_DIR ps3mfw_gui.tcl]
+ source [file join $PS3MFW_DIR scrolledframe.tcl]
+ source [file join $PS3MFW_DIR tracedtext.tcl]
+ ::gui::create_gui $arguments $tasks
+} else {
+ if {[llength $arguments] != 2} {
+ # exits
+ usage
+ }
+
+ set IN_FILE [lindex $arguments 0]
+ set OUT_FILE [lindex $arguments 1]
+
+ build_mfw $IN_FILE $OUT_FILE $tasks
+ exit
+}
View
BIN  ps3mfw.exe
Binary file not shown
View
495 ps3mfw_base.tcl
@@ -0,0 +1,495 @@
+#!/usr/bin/tclsh
+#
+# ps3mfw -- PS3 MFW creator
+#
+# Copyright (C) Anonymous Developers (Code Monkeys)
+#
+# This software is distributed under the terms of the GNU General Public
+# License ("GPL") version 3, as published by the Free Software Foundation.
+#
+
+# PRINT USAGE
+proc usage {{msg ""}} {
+ global options
+
+ ego
+
+ if {$msg != ""} {
+ puts $msg
+ }
+ puts "Usage: $::argv0 \[options\] <Original> <Modified> \[task\] \[task options\]"
+ puts "eg. $::argv0 PS3UPDAT.PUP PS3UPDAT.MFW.PUP"
+ puts ""
+ puts "Available options are : "
+ foreach option [get_sorted_options [file normalize [info script]] [array names options]] {
+ puts " $option \"$options($option)\"\n [get_option_description [file normalize [info script]] $option]"
+ }
+ puts "\nAvailable tasks are : "
+ foreach task [get_sorted_task_files] {
+ puts "\nTask:\n--[string map {_ -} [file rootname [file tail $task]]] : [string map {\n \n\t\t\t\t} [get_task_description $task]]"
+ set taskname [file rootname [file tail $task]]
+ if { [llength [array names ::${taskname}::options]] } {
+ puts " Task options:"
+ foreach option [get_sorted_options $task [array names ::${taskname}::options]] {
+ puts " $option \"[set ::${taskname}::options($option)]\"\n [get_option_description $task $option]"
+ }
+ }
+ }
+ puts ""
+ exit -1
+}
+
+proc get_log_fd {} {
+ global log_fd LOG_FILE
+
+ if {![info exists log_fd]} {
+ set log_fd [open $LOG_FILE w]
+ fconfigure $log_fd -buffering none
+ }
+ return $log_fd
+}
+
+proc log {msg {force 0}} {
+ global options
+
+ if {!$options(--silent) || $force} {
+ set fd [get_log_fd]
+ puts $fd $msg
+ if {$force} {
+ puts stderr $msg
+ } else {
+ puts $msg
+ }
+ }
+}
+
+proc debug {msg} {
+ if {$::options(--debug)} {
+ log $msg 1
+ }
+}
+
+proc grep {re args} {
+ set result [list]
+ set files [eval glob -types f $args]
+ foreach file $files {
+ set fp [open $file]
+ set l 0
+ while {[gets $fp line] >= 0} {
+ if [regexp -- $re $line] {
+ lappend result [list $file $line $l]
+ }
+ incr l
+ }
+ close $fp
+ }
+ set result
+}
+
+proc _get_comment_from_file {filename re} {
+ set results [grep $re $filename]
+ set comment ""
+ foreach match $results {
+ foreach {file match line} $match break
+ append comment "[string trim [regsub $re $match {}]]\n"
+ }
+ string trim $comment
+}
+proc get_task_description {filename} {
+ return [_get_comment_from_file $filename {^# Description:}]
+}
+
+proc get_option_description {filename option} {
+ return [_get_comment_from_file $filename "^# Option $option:"]
+}
+
+proc get_sorted_options {filename options} {
+ return [lsort -command [list sort_options $filename] $options]
+}
+
+proc sort_options {file opt1 opt2 } {
+ set re1 "^# Option $opt1:"
+ set re2 "^# Option $opt2:"
+ set results1 [grep $re1 $file]
+ set results2 [grep $re2 $file]
+
+ if {$results1 == {} && $results2 == {}} {
+ return [string compare $opt1 $opt2]
+ } elseif {$results1 == {}} {
+ return 1
+ } elseif {$results2 == {}} {
+ return -1
+ } else {
+ foreach {file match line1} [lindex $results1 0] break
+ foreach {file match line2} [lindex $results2 0] break
+ return [expr {$line1 - $line2}]
+ }
+}
+
+proc task_to_file {task} {
+ return [file join $::TASKS_DIR ${task}.tcl]
+}
+
+proc file_to_task {file} {
+ return [file rootname [file tail $file]]
+}
+
+proc compare_tasks {task1 task2} {
+ return [compare_task_files [task_to_file $task1] [task_to_file $task2]]
+}
+
+proc compare_task_files {file1 file2} {
+ set prio1 [_get_comment_from_file $file1 {^# Priority:}]
+ set prio2 [_get_comment_from_file $file2 {^# Priority:}]
+
+ if {$prio1 == {} && $prio2 == {}} {
+ return [string compare $file1 $file2]
+ } elseif {$prio1 == {}} {
+ return 1
+ } elseif {$prio2 == {}} {
+ return -1
+ } else {
+ return [expr {$prio1 - $prio2}]
+ }
+}
+
+proc sort_tasks {tasks} {
+ return [lsort -command compare_tasks $tasks]
+}
+
+proc sort_task_files {files} {
+ return [lsort -command compare_task_files $files]
+}
+
+proc get_sorted_tasks { {tasks {}} } {
+ set files [glob -nocomplain [file join $::TASKS_DIR *.tcl]]
+ set tasks [list]
+ foreach file $files {
+ lappend tasks [file_to_task $file]
+ }
+ return [sort_tasks $tasks]
+}
+
+proc get_sorted_task_files { } {
+ set files [glob -nocomplain [file join $::TASKS_DIR *.tcl]]
+ return [sort_task_files $files]
+}
+
+proc get_selected_tasks { } {
+ return $::selected_tasks
+}
+
+# failure function
+proc die {message} {
+ global LOG_FILE
+
+ log "FATAL ERROR: $message" 1
+ puts stderr "See ${LOG_FILE} for more info"
+ puts stderr "Last lines of log : "
+ puts stderr "*****************"
+ catch {puts stderr "[tail $LOG_FILE]"}
+ puts stderr "*****************"
+ exit -2
+}
+
+proc catch_die {command message} {
+ set catch {
+ if {[catch {@command@} res] } {
+ die "@message@ : $res"
+ }
+ return $res
+ }
+ debug "Executing command $command"
+ set catch [string map [list "@command@" "$command" "@message@" "$message"] $catch]
+ uplevel 1 $catch
+}
+
+proc shell {args} {
+ set fd [get_log_fd]
+ debug "Executing shell $args"
+ eval exec $args >&@ $fd
+}
+
+proc hexify { str } {
+ set out ""
+ for {set i 0} { $i < [string length $str] } { incr i} {
+ set c [string range $str $i $i]
+ binary scan $c H* h
+ append out "\[$h\]"
+ }
+ return $out
+}
+
+proc tail {filename {n 10}} {
+ set fd [open $filename r]
+ set lines [list]
+ while {![eof $fd]} {
+ lappend lines [gets $fd]
+ if {[llength $lines] > $n} {
+ set lines [lrange $lines end-$n end]
+ }
+ }
+ close $fd
+ return [join $lines "\n"]
+}
+
+proc copy_file {src dest} {
+ catch_die {file copy $src $dest} "Unable to copy $src to $dest"
+}
+
+
+proc pup_extract {pup dest} {
+# shell $::PUP x $pup $dest
+ shell $::PUPUNPACK [file nativename $pup] [file nativename $dest]
+}
+
+proc pup_create {dir pup build} {
+# shell $::PUP c $dir $pup $build
+ shell $::PUPPACK $pup [file nativename $dir] [file nativename $build]
+}
+
+proc pup_get_build_version {pup} {
+ set fd [open $pup r]
+ fconfigure $fd -translation binary
+ seek $fd 16
+ set build [read $fd 8]
+ close $fd
+
+ if {[binary scan $build W build_ver] != 1} {
+ error "Cannot read 64 bit big endian from [hexify $build]"
+ }
+
+ return $build_ver
+}
+
+
+proc extract_tar {tar dest} {
+
+ file mkdir $dest
+ debug "Extracting tar file [file tail $tar] into [file tail $dest]"
+ catch_die {::tar::untar $tar -dir $dest} "Could not untar file $tar"
+}
+proc create_tar {tar directory files} {
+ set debug [file tail $tar]
+ if {$debug == "content" } {
+ set debug [file tail [file dirname $tar]]
+ }
+ debug "Creating tar file $debug"
+ set pwd [pwd]
+ cd $directory
+ catch_die {::tar::create $tar $files} "Could not create tar file $tar"
+ cd $pwd
+}
+
+proc find_devflash_archive {dir find} {
+
+ foreach file [glob -nocomplain [file join $dir * content]] {
+ if {[catch {::tar::stat $file $find}] == 0} {
+ return $file
+ }
+ }
+ return ""
+}
+
+proc unpkg { pkg dest } {
+ shell $::UNPKG [file nativename $pkg] [file nativename $dest]
+}
+
+proc pkg { pkg dest } {
+ shell $::PKG retail [file nativename $pkg] [file nativename $dest]
+}
+
+proc unpkg_archive {pkg dest} {
+ debug "unpkg-ing file [file tail $pkg]"
+ catch_die {unpkg $pkg $dest} "Could not unpkg file [file tail $pkg]"
+}
+
+proc pkg_archive {dir pkg} {
+ debug "pkg-ing file [file tail $pkg]"
+ catch_die {pkg $dir $pkg} "Could not pkg file [file tail $pkg]"
+}
+
+proc unpkg_devflash_all {dir} {
+ file mkdir $dir
+ foreach file [lsort [glob -nocomplain [file join $::CUSTOM_UPDATE_DIR dev_flash_*]]] {
+ unpkg_archive $file [file join $dir [file tail $file]]
+ }
+}
+
+proc cosunpkg { pkg dest } {
+ shell $::COSUNPKG [file nativename $pkg] [file nativename $dest]
+}
+
+proc cospkg { dir pkg } {
+ shell $::COSPKG [file nativename $pkg] [file nativename $dir]
+}
+
+proc cosunpkg_package { pkg dest } {
+ debug "cosunpkg-ing file [file tail $pkg]"
+ catch_die { cosunpkg $pkg $dest } "Could not cosunpkg file [file tail $pkg]"
+}
+
+proc cospkg_package { dir pkg } {
+ debug "cospkg-ing file [file tail $dir]"
+ catch_die { cospkg $dir $pkg } "Could not cospkg file [file tail $pkg]"
+}
+
+proc modify_coreos_file { file callback args } {
+ log "Modifying CORE_OS file [file tail $file]"
+ set pkg [file join $::CUSTOM_UPDATE_DIR CORE_OS_PACKAGE.pkg]
+ set unpkgdir [file join $::CUSTOM_UPDATE_DIR CORE_OS_PACKAGE.unpkg]
+ set cosunpkgdir [file join $::CUSTOM_UPDATE_DIR CORE_OS_PACKAGE]
+
+ ::unpkg_archive $pkg $unpkgdir
+ ::cosunpkg_package [file join $unpkgdir content] $cosunpkgdir
+
+ if {[file writable [file join $cosunpkgdir $file]] } {
+ eval $callback [file join $cosunpkgdir $file] $args
+ } elseif { ![file exists [file join $cosunpkgdir $file]] } {
+ die "Could not find $file in CORE_OS_PACKAGE"
+ } else {
+ die "File $file is not writable in CORE_OS_PACKAGE"
+ }
+
+ ::cospkg_package $cosunpkgdir [file join $unpkgdir content]
+ ::pkg_archive $unpkgdir $pkg
+}
+
+proc get_build_version {file} {
+ catch_die {pup_get_build_version $file} "Could not get the PUP file information"
+ return [pup_get_build_version $file]
+}
+
+proc sed_in_place {file search replace} {
+ set fd [open $file r]
+ set data [read $fd]
+ close $fd
+
+ set data [string map [list $search $replace] $data]
+
+ set fd [open $file w]
+ puts -nonewline $fd $data
+ close $fd
+}
+
+proc unself {in out} {
+ shell $::UNSELF [file nativename $in] [file nativename $out]
+}
+
+proc makeself {in out original} {
+ shell $::MAKESELF [file nativename $in] [file nativename $out] [file nativename $original]
+}
+
+proc decrypt_self {in out} {
+ debug "Decrypting self file [file tail $in]"
+ catch_die {unself $in $out} "Could not decrypt file [file tail $in]"
+}
+
+proc sign_elf {in out original} {
+ debug "Rebuilding self file [file tail $out]"
+ catch_die {makeself $in $out $original} "Could not rebuild file [file tail $out]"
+}
+
+proc modify_self_file {file callback args} {
+ log "Modifying self/sprx file [file tail $file]"
+ decrypt_self $file ${file}.elf
+ eval $callback ${file}.elf $args
+ sign_elf ${file}.elf ${file}.self $file
+ file rename -force ${file}.self $file
+ file delete ${file}.elf
+}
+
+proc patch_self {file search replace_offset replace {ignore_bytes {}}} {
+ modify_self_file $file patch_elf $search $replace_offset $replace $ignore_bytes
+}
+
+proc patch_elf {file search replace_offset replace {ignore_bytes {}}} {
+ patch_file $file $search $replace_offset $replace $ignore_bytes
+}
+
+proc patch_file {file search replace_offset replace {ignore_bytes {}}} {
+ foreach bytes $ignore_bytes {
+ if {[llength $bytes] == 0} {
+ set search [string replace $search $bytes $bytes "?"]
+ } else {
+ set search [string replace $search [lindex $bytes 0] [lindex $bytes 1] "?"]
+ }
+ }
+ set fd [open $file r+]
+ fconfigure $fd -translation binary
+
+ set offset -1
+ set buffer ""
+ while {![eof $fd]} {
+ append buffer [read $fd 1]
+ if {[string length $buffer] > [string length $search]} {
+ set buffer [string range $buffer 1 end]
+ }
+ set tmp $buffer
+ foreach bytes $ignore_bytes {
+ if {[llength $bytes] == 0} {
+ set tmp [string replace $tmp $bytes $bytes "?"]
+ } else {
+ set tmp [string replace $tmp [lindex $bytes 0] [lindex $bytes 1] "?"]
+ }
+ }
+ if {$tmp == $search} {
+ if {$offset != -1} {
+ error "Pattern found multiple times"
+ }
+ set offset [tell $fd]
+ incr offset -[string length $search]
+ incr offset $replace_offset
+ }
+ }
+ if {$offset == -1} {
+ error "Could not find pattern to patch"
+ }
+ seek $fd $offset
+ puts -nonewline $fd $replace
+ close $fd
+}
+
+proc modify_devflash_file {file callback args} {
+ log "Modifying dev_flash file [file tail $file]"
+ set tar_file [find_devflash_archive $::CUSTOM_DEVFLASH_DIR $file]
+
+ if {$tar_file == ""} {
+ die "Could not find [file tail $file]"
+ }
+
+ set pkg_file [file tail [file dirname $tar_file]]
+ debug "Found [file tail $file] in $pkg_file"
+
+ file delete -force [file join $::CUSTOM_DEVFLASH_DIR dev_flash]
+ extract_tar $tar_file $::CUSTOM_DEVFLASH_DIR
+
+ if {[file writable [file join $::CUSTOM_DEVFLASH_DIR $file]] } {
+ eval $callback [file join $::CUSTOM_DEVFLASH_DIR $file] $args
+ } elseif { ![file exists [file join $::CUSTOM_DEVFLASH_DIR $file]] } {
+ die "Could not find $file in $::CUSTOM_DEVFLASH_DIR"
+ } else {
+ die "File $file is not writable in $::CUSTOM_DEVFLASH_DIR"
+ }
+
+ file delete -force $tar_file
+
+ create_tar $tar_file $::CUSTOM_DEVFLASH_DIR dev_flash
+
+ set pkg [file join $::CUSTOM_UPDATE_DIR $pkg_file]
+ set unpkgdir [file join $::CUSTOM_DEVFLASH_DIR $pkg_file]
+ pkg_archive $unpkgdir $pkg
+}
+
+proc remove_node_from_xmb_xml { xml key message} {
+ log "Removing \"$message\" from XML"
+
+ while { [::xml::GetNodeByAttribute $xml "XMBML:View:Attributes:Table" key $key] != "" } {
+ set xml [::xml::RemoveNode $xml [::xml::GetNodeIndicesByAttribute $xml "XMBML:View:Attributes:Table" key $key]]
+ }
+ while { [::xml::GetNodeByAttribute $xml "XMBML:View:Items:Query" key $key] != "" } {
+ set xml [::xml::RemoveNode $xml [::xml::GetNodeIndicesByAttribute $xml "XMBML:View:Items:Query" key $key]]
+ }
+
+ return $xml
+}
View
563 ps3mfw_gui.tcl
@@ -0,0 +1,563 @@
+#!/usr/bin/tclsh
+#
+# ps3mfw -- PS3 MFW creator
+#
+# Copyright (C) Anonymous Developers (Code Monkeys)
+#
+# This software is distributed under the terms of the GNU General Public
+# License ("GPL") version 3, as published by the Free Software Foundation.
+#
+
+if { $::tcl_platform(os) == "Linux" } {
+ ::ttk::setTheme "clam"
+}
+
+set icon32 [image create photo -file [file join $::PS3MFW_DIR images ps3mfw-icon-32.gif]]
+set icon128 [image create photo -file [file join $::PS3MFW_DIR images ps3mfw-icon-128.gif]]
+if { [catch {wm iconphoto . -default $icon128 $icon32} res] } {
+ puts "error $res"
+ catch {wm iconbitmap . -default [file join $::PS3MFW_DIR images ps3mfw-icon.ico]}
+}
+
+# This is a hack to use the window state 'zoomed' on Linux (X11).
+if { [catch {tk windowingsystem} wsystem] == 0 && $wsystem == "x11" && \
+ [info commands ::tk::wm] == "" && [info commands wm] == "wm" } {
+ rename wm ::tk::wm
+ proc ::wm {option window args} {
+ if {$option == "state"} {
+ if {[llength $args] == 0} {
+ set state [::tk::wm state $window]
+ if {$state == "normal"} {
+ if {[::tk::wm attributes $window -zoomed]} {
+ return "zoomed"
+ }
+ }
+ return $state
+ } elseif {[llength $args] == 1} {
+ set state [lindex $args 0]
+ if {$state == "normal"} {
+ ::tk::wm attributes $window -zoomed 0
+ ::tk::wm state $window normal
+ } elseif {$state == "zoomed"} {
+ ::tk::wm state $window normal
+ ::tk::wm attributes $window -zoomed 1
+ } else {
+ if {[catch {::tk::wm state $window $state} err]} {
+ if {[string first $err "bad argument"] == 0} {
+ error "bad argument \"$state\": must be normal, iconic, withdrawn or zoomed"
+ } else {
+ return -code error $err
+ }
+ }
+ }
+ } else {
+ error "wrong # args: should be \"wm state window ?state?\""
+ }
+ } else {
+ eval [linsert $args 0 ::tk::wm $option $window]
+ }
+ }
+}
+
+
+
+namespace eval ::gui {
+ variable tasks
+ array set tasks {}
+ variable padx 2
+ variable pady 1
+ variable theme [set ::ttk::currentTheme]
+
+ proc create_gui {arguments selected_tasks} {
+ variable tasks
+
+ wm title . "PS3MFW Builder v$::PS3MFW_VERSION"
+ create_menu
+
+ if {![catch {tk windowingsystem} wsystem] && $wsystem == "aqua"} {
+ bind . <Command-Shift-C> "console show"
+ } else {
+ bind . <Control-Shift-C> "console show"
+ }
+
+ hijack_logs
+
+ if {[llength $arguments] > 2} {
+ wm withdraw .
+ tk_messageBox -default ok -message "Invalid arguments received" -icon warning
+ wm state . normal
+ set arguments [list]
+ }
+
+ set left [::ttk::frame .left]
+ set middle [::ttk::frame .middle]
+ set right [::ttk::frame .right]
+
+ pack $left -side left -expand false -fill y -padx $::gui::padx -pady $::gui::pady
+ pack $right -side right -expand false -fill y -padx $::gui::padx -pady $::gui::pady
+ pack $middle -side left -expand true -fill both -padx $::gui::padx -pady $::gui::pady
+ set files [::ttk::frame .left.files]
+ set options_frame [::ttk::labelframe .left.options -text "Options"]
+ set tasks_labelframe [::ttk::labelframe .left.tasks -text "Tasks"]
+ set tasks_scrollframe [scrolledframe::scrolledframe .left.tasks.f \
+ -yscrollcommand [list ::gui::set_scroll $tasks_labelframe.sy] \
+ -xscrollcommand [list ::gui::set_scroll $tasks_labelframe.sx]]
+ set tasks_frame [$tasks_scrollframe getframe]
+ set tasks_sy [::ttk::scrollbar $tasks_labelframe.sy -orient vertical \
+ -command [list $tasks_scrollframe yview]]
+ set tasks_sx [::ttk::scrollbar $tasks_labelframe.sx -orient horizontal \
+ -command [list $tasks_scrollframe xview]]
+ grid $tasks_scrollframe -row 0 -column 0 -sticky nsew -padx $::gui::padx -pady $::gui::pady
+ grid $tasks_sy -row 0 -column 1 -sticky ns -padx $::gui::padx -pady $::gui::pady
+ grid $tasks_sx -row 1 -column 0 -sticky ew -padx $::gui::padx -pady $::gui::pady
+ grid rowconfigure $tasks_labelframe 0 -weight 1
+ grid columnconfigure $tasks_labelframe 0 -weight 1
+ pack $files $options_frame -side top -expand false -fill x -padx $::gui::padx -pady $::gui::pady
+ pack $tasks_labelframe -side top -expand true -fill both -padx $::gui::padx -pady $::gui::pady
+ set input [::ttk::frame .left.files.input]
+ set output [::ttk::frame .left.files.output]
+ pack $input $output -side top -expand true -fill both -padx $::gui::padx -pady $::gui::pady
+ set input_label [::ttk::label .left.files.input.label -text "Original Firmware :"]
+ set input_entry [::ttk::entry .left.files.input.entry -textvariable ::IN_FILE]
+ set input_button [::ttk::button .left.files.input.button -text "Browse" -command [list ::gui::browse open $input_entry]]
+ pack $input_label $input_entry $input_button -side left -expand true -fill x -anchor nw -padx $::gui::padx -pady $::gui::pady
+ set output_label [::ttk::label .left.files.output.label -text "Modified Firmware :"]
+ set output_entry [::ttk::entry .left.files.output.entry -textvariable ::OUT_FILE]
+ set output_button [::ttk::button .left.files.output.button -text "Browse" -command [list ::gui::browse save $output_entry]]
+ pack $output_label $output_entry $output_button -side left -expand true -fill x -anchor nw -padx $::gui::padx -pady $::gui::pady
+
+ set ::IN_FILE [lindex $arguments 0]
+ set ::OUT_FILE [lindex $arguments 1]
+
+ set build [::ttk::button .right.build -text "Build MFW" -command ::gui::build_mfw]
+ set exit [::ttk::button .right.exit -text "Quit" -command exit]
+ set about [::ttk::labelframe .right.about -text "About PS3MFW Builder"]
+ set themes [::ttk::labelframe .right.themes -text "Theme"]
+ populate_themes $themes
+ add_about_msg $about
+ pack $build $exit $about $themes -side top -expand false -fill both -padx $::gui::padx -pady $::gui::pady
+
+ unset ::options(--gui)
+ foreach opt [get_sorted_options [file normalize [info script]] [array names ::options]] {
+ build_option $options_frame [file normalize [info script]] $opt ::options($opt)
+ }
+
+ foreach task [get_sorted_tasks] {
+ if {[lsearch $selected_tasks $task] == -1} {
+ set tasks($task) false
+ } else {
+ set tasks($task) true
+ }
+ build_task $tasks_frame $task [task_to_file $task]
+ }
+ wm state . zoomed
+
+ # Force tasks window to have the right size
+ update
+ set tasks_width [winfo reqwidth $tasks_frame]
+ $tasks_scrollframe configure -width $tasks_width
+
+ task_selected $tasks_frame [lindex $selected_tasks 0]
+
+
+ if {![catch {tk windowingsystem} wsystem] && $wsystem == "x11"} {
+ bind . <Button-4> {::gui::scrollWidget %W -1}
+ bind . <Button-5> {::gui::scrollWidget %W 1}
+ } else {
+ bind . <MouseWheel> {
+ if {%D >= 0} {
+ ::gui::scrollWidget %W -1
+ } else {
+ ::gui::scrollWidget %W 1
+ }
+ }
+ }
+ }
+
+ proc scrollWidget {w d} {
+ if {[winfo class $w] == "Text"} {
+ return
+ }
+ if {[winfo class $w] == "Canvas"} {
+ $w yview scroll $d units
+ } elseif {[winfo parent $w] != "" } {
+ scrollWidget [winfo parent $w] $d
+ }
+ }
+
+ proc create_menu {} {
+ set menu .menu
+
+ menu $menu -tearoff 0 -type menubar -borderwidth 0 -activeborderwidth -0
+
+ # App menu, only on Mac OS X (see Mac Interface Guidelines)
+ if {![catch {tk windowingsystem} wsystem] && $wsystem == "aqua"} {
+ set appmenu $menu.apple
+ $menu add cascade -label "PS3MFW Builder" -menu $appmenu
+ menu $appmenu -tearoff 0 -type normal
+ $appmenu add command -label "About PS3MFW Builder" \
+ -command ::gui::about
+ $appmenu add separator
+ }
+
+ set filemenu [menu $menu.file -tearoff 0 -type normal]
+ $filemenu add command -label "Select Official firmware" \
+ -command [list ::gui::browse open .left.files.input.entry]
+ $filemenu add command -label "Select Destination MFW firmware" \
+ -command [list ::gui::browse save .left.files.output.entry]
+ $filemenu add separator
+ $filemenu add command -label "Build MFW" -command ::gui::build_mfw
+ $filemenu add separator
+ $filemenu add command -label "Exit" -command "exit"
+
+ set thememenu [menu $menu.theme -tearoff 0 -type normal]
+ set helpmenu [menu $menu.help -tearoff 0 -type normal]
+ $helpmenu add command -label "About PS3MFW Builder" -command ::gui::about
+
+ $menu add cascade -label "File" -menu $filemenu
+ $menu add cascade -label "Theme" -menu $thememenu
+ $menu add cascade -label "Help" -menu $helpmenu
+
+ . configure -menu $menu
+ }
+
+ proc add_about_msg { about } {
+ set icon128 [image create photo -file [file join $::PS3MFW_DIR images ps3mfw-icon-128.gif]]
+ pack [::ttk::label $about.img -image $icon128 -anchor center] -expand false -fill both
+ pack [::ttk::label $about.l1 -text "PS3MFW Builder v0.1" -anchor center] -expand false -fill x
+ pack [::ttk::label $about.l2 -text "" -anchor center] -expand false -fill x
+ pack [::ttk::label $about.l3 -text "Developed by :" -anchor center] -expand false -fill x
+ pack [::ttk::label $about.l4 -text "Anonymous Developers" -anchor center] -expand false -fill x
+ pack [::ttk::label $about.l5 -text "" -anchor center] -expand false -fill x
+ }
+
+ proc about { } {
+ destroy .about
+ toplevel .about
+ wm title .about "About PS3MFW Builder"
+
+ ::ttk::frame .about.f
+ pack .about.f -expand true -fill both
+ add_about_msg .about.f
+
+ regexp {=?(\d+)x(\d+)[+\-](-?\d+)[+\-](-?\d+)} [winfo geometry .] -> width height x y
+ set middle_x [expr {$x + ($width / 2)}]
+ set middle_y [expr {$y + ($height / 2)}]
+ set w 350
+ set h 350
+ incr middle_x -[expr {int($w / 2)}]
+ incr middle_y -[expr {int($h / 2)}]
+ wm geometry .about ${w}x${h}+${middle_x}+${middle_y}
+ }
+
+ proc populate_themes {themes} {
+
+ array set THEMES {
+ alt "Revitalized"
+ aqua "Aqua"
+ classic "Classic"
+ default "Default"
+ winnative "Windows native"
+ xpnative "XP Native"
+ }
+
+ # Add in any available loadable themes:
+ foreach name [::ttk::themes] {
+ if {![info exists THEMES($name)]} {
+ set THEMES($name) [string totitle $name]
+ }
+ }
+
+ foreach {theme name} [array get THEMES] {
+ set b [::ttk::radiobutton $themes.s$theme \
+ -text $name \
+ -variable ::gui::theme -value $theme \
+ -command [list ::ttk::setTheme $theme]]
+ .menu.theme add radiobutton -label "$name" \
+ -variable ::gui::theme -value $theme \
+ -command [list ::ttk::setTheme $theme]
+
+ pack $b -side top -expand false -fill x -padx $::gui::padx -pady $::gui::pady
+
+ if { [lsearch -exact [package names] ttk::theme::$theme] == -1} {
+ .menu.theme entryconfigure end -state disabled
+ $themes.s$theme state disabled
+ }
+ }
+ }
+
+ proc build_option {w file name option} {
+ set description [get_option_description $file $name]
+ if {$description == ""} {
+ set description $name
+ }
+ if {[string is boolean -strict [set $option]]} {
+ set widget [::ttk::checkbutton $w.$name -text $description -variable $option -onvalue true -offvalue false]
+ } elseif {[string first "\n" [set $option]] == -1} {
+ set widget [::ttk::frame $w.$name]
+ set label [::ttk::label $w.$name.label -text "$description :"]
+ set entry [::ttk::entry $w.$name.entry -textvariable $option]
+ pack $label $entry -side left -expand true -fill x -padx $::gui::padx -pady $::gui::pady -anchor nw
+ } else {
+ set widget [::ttk::frame $w.$name]
+ set label [::ttk::label $w.$name.label -text "$description :"]
+ set frame [::ttk::frame $w.$name.f]
+ set text [::TracedText::TracedText $frame.text -textvariable $option -wrap none \
+ -yscrollcommand [list ::gui::set_scroll $frame.sy] \
+ -xscrollcommand [list ::gui::set_scroll $frame.sx]];
+ set sy [::ttk::scrollbar $frame.sy -orient vertical -command [list $text yview]]
+ set sx [::ttk::scrollbar $frame.sx -orient horizontal -command [list $text xview]]
+
+ grid $text -row 0 -column 0 -sticky nsew -padx $::gui::padx -pady $::gui::pady
+ grid $sy -row 0 -column 1 -sticky ns -padx $::gui::padx -pady $::gui::pady
+ grid $sx -row 1 -column 0 -sticky ew -padx $::gui::padx -pady $::gui::pady
+ grid rowconfigure $frame 0 -weight 1
+ grid columnconfigure $frame 0 -weight 1
+ #pack $sy -side right -fill y -padx $::gui::padx -pady $::gui::pady
+ #pack $sx -side bottom -fill x -padx $::gui::padx -pady $::gui::pady
+ #pack $text -expand true -fill both -padx $::gui::padx -pady $::gui::pady -anchor nw
+ pack $label $frame -side top -expand true -fill x -padx $::gui::padx -pady $::gui::pady
+ }
+ pack $widget -side top -expand false -fill x -padx $::gui::padx -pady $::gui::pady -anchor nw
+ }
+ proc set_scroll {w min max} {
+
+ $w set $min $max
+ if {$min == 0.0 && $max == 1.0} {
+ grid forget $w
+ } elseif {[grid info $w] == ""} {
+ if {[$w cget -orient] == "vertical"} {
+ grid $w -row 0 -column 1 -sticky ns -padx $::gui::padx -pady $::gui::pady
+ } else {
+ grid $w -row 1 -column 0 -sticky ew -padx $::gui::padx -pady $::gui::pady
+ }
+ }
+ }
+
+ proc build_task {w task file} {
+ variable tasks
+
+ set frame [::ttk::frame $w.$task]
+ set check [::ttk::checkbutton $w.$task.check -text [get_task_description $file] -variable ::gui::tasks($task) -onvalue true -offvalue false -command [list ::gui::task_selected $w $task]]
+ set button [::ttk::button $w.$task.button -text "Configure >>" -command [list ::gui::task_selected $w $task]]
+ pack $check -side left -expand true -fill x -padx $::gui::padx -pady $::gui::pady
+ pack $button -side right -expand false -fill x -padx $::gui::padx -pady $::gui::pady
+ pack $frame -side top -expand true -fill x -padx $::gui::padx -pady $::gui::pady -anchor nw
+
+ variable task_${task}_options
+ set file [file join $::TASKS_DIR $task.tcl]
+ if {![info exists task_${task}_options] } {
+ array set ts [array get ::${task}::options]
+ catch {unset ::${task}::options}
+ uplevel #0 [list source $file]
+ array set task_${task}_options [array get ::${task}::options]
+ array set ::${task}::options [array get ts]
+ foreach opt [array names task_${task}_options] {
+ set task_${task}_options($opt) [set ::${task}::options($opt)]
+ }
+ }
+ }
+
+ proc build_tasks_options { task } {
+ variable task_${task}_options
+ foreach child [winfo children .middle] {
+ destroy $child
+ }
+ set labelframe [::ttk::labelframe .middle.task -text "Task Options"]
+ pack $labelframe -expand true -fill both -padx $::gui::padx -pady $::gui::pady
+ set scrollframe [scrolledframe::scrolledframe $labelframe.f \
+ -yscrollcommand [list ::gui::set_scroll $labelframe.sy] \
+ -xscrollcommand [list ::gui::set_scroll $labelframe.sx]]
+ set frame [$scrollframe getframe]
+ set sy [::ttk::scrollbar $labelframe.sy -orient vertical \
+ -command [list $scrollframe yview]]
+ set sx [::ttk::scrollbar $labelframe.sx -orient horizontal \
+ -command [list $scrollframe xview]]
+ grid $scrollframe -row 0 -column 0 -sticky nsew -padx $::gui::padx -pady $::gui::pady
+ grid $sy -row 0 -column 1 -sticky ns -padx $::gui::padx -pady $::gui::pady
+ grid $sx -row 1 -column 0 -sticky ew -padx $::gui::padx -pady $::gui::pady
+ grid rowconfigure $labelframe 0 -weight 1
+ grid columnconfigure $labelframe 0 -weight 1
+
+ set file [file join $::TASKS_DIR $task.tcl]
+ foreach opt [get_sorted_options $file [array names task_${task}_options]] {
+ build_option $frame $file $opt ::gui::task_${task}_options($opt)
+ }
+ # Force tasks option window to have the right size
+ update
+ set tasks_width [winfo reqwidth $frame]
+ $scrollframe configure -width $tasks_width
+ }
+
+ proc button_hovered { w } {
+ if {[$w cget -state] == "active"} {
+ after 0 [list $w configure -state active]
+ }
+ }
+ proc task_selected {w task} {
+ foreach child [winfo children $w] {
+ if {[winfo exists $child.button] } {
+ $child.button configure -state normal
+ bind $child.button <Leave> ""
+ }
+ }
+ $w.$task.button configure -state active
+ bind $w.$task.button <Leave> [list ::gui::button_hovered $w.$task.button]
+ build_tasks_options $task
+
+ }
+
+ proc browse { type path } {
+ set filetypes {{ "PS3 Firmware Update" {*.PUP *.pup} }}
+ if {$type == "open" } {
+ # taken in part from aMSN
+ if { ![info exists initialfile] || $initialfile == "" } {
+ set initialfile $::IN_FILE
+ }
+
+ if { ![file exists $initialfile] } {
+ set initialfile ""
+ set file [tk_getOpenFile -defaultextension ".PUP" -filetypes $filetypes -multiple false -parent $path -title "Choose the Official Firmware Update"]
+ } else {
+ set file [tk_getOpenFile -defaultextension ".PUP" -filetypes $filetypes -initialfile $initialfile -multiple false -parent $path -title "Choose the Official Firmware Update"]
+ }
+ #set file [tk_getOpenFile -defaultextension ".PUP" -filetypes $filetypes -initialfile $::IN_FILE -multiple false -parent $path -title "Choose the Official Firmware Update"]
+ } else {
+ set file [tk_getSaveFile -defaultextension ".PUP" -filetypes $filetypes -initialfile $::OUT_FILE -parent $path -title "Choose the destination Modified Firmware"]
+ }
+ if {$file != ""} {
+ $path delete 0 end
+ $path insert 0 $file
+ }
+ }
+
+ proc set_gui_state { state } {
+ .left.files.input.entry configure -state $state
+ .left.files.input.button configure -state $state
+ .left.files.output.entry configure -state $state
+ .left.files.output.button configure -state $state
+ .right.build configure -state $state
+
+ foreach child [winfo children .left.options] {
+ if {[winfo exists $child.entry] } {
+ $child.entry configure -state $state
+ } else {
+ $child configure -state $state
+ }
+ }
+ foreach child [winfo children [.left.tasks.f getframe]] {
+ if {[winfo exists $child.button] } {
+ $child.check configure -state $state
+ $child.button configure -state $state
+ if {$state == "normal" && [bind $child.button] == "<Leave>"} {
+ $child.button configure -state active
+ }
+ }
+ }
+ }
+
+ proc enable_gui { } {
+ variable tasks
+
+ pack .left -side left -expand false -fill y -padx $::gui::padx -pady $::gui::pady -before .middle
+ set_gui_state normal
+ }
+ proc disable_gui { } {
+ set_gui_state disabled
+
+ pack forget .left
+ foreach child [winfo children .middle] {
+ destroy $child
+ }
+
+ text .middle.log -wrap none -bg black -fg green -yscrollcommand [list ::gui::set_scroll .middle.sy] \
+ -xscrollcommand [list ::gui::set_scroll .middle.sx]
+ ::ttk::scrollbar .middle.sy -orient vertical -command ".middle.log yview"
+ ::ttk::scrollbar .middle.sx -orient horizontal -command ".middle.log xview"
+
+ .middle.log tag configure warning -foreground red
+ .middle.log tag configure info -foreground blue
+ grid .middle.log -row 0 -column 0 -sticky nsew -padx $::gui::padx -pady $::gui::pady
+ grid .middle.sy -row 0 -column 1 -sticky ns -padx $::gui::padx -pady $::gui::pady
+ grid .middle.sx -row 1 -column 0 -sticky ew -padx $::gui::padx -pady $::gui::pady
+ grid rowconfigure .middle 0 -weight 1
+ grid columnconfigure .middle 0 -weight 1
+ }
+
+ proc build_mfw { } {
+ variable tasks
+
+ disable_gui
+
+
+ set cmdline "$::argv0 \"$::IN_FILE\" \"$::OUT_FILE\""
+ foreach {opt val} [array get ::options] {
+ append cmdline " $opt \"$val\""
+ }
+
+ set selected_tasks [list]
+ foreach task [array names tasks] {
+ catch {unset ::${task}::options}
+ if {$tasks($task)} {
+ lappend selected_tasks $task
+ variable task_${task}_options
+ array set ::${task}::options [array get task_${task}_options]
+ append cmdline " --[string map {_ -} $task]"
+ foreach {opt val} [array get task_${task}_options] {
+ append cmdline " $opt \"$val\""
+ }
+ }
+ }
+ append cmdline " --gui false"
+
+ print_log "Command line to use to repeat this process : \n$cmdline\n\n" info
+
+ if {[catch {::build_mfw $::IN_FILE $::OUT_FILE $selected_tasks} res]} {
+ log "Error running script: $res" 1
+ tk_messageBox -default ok -message "FATAL ERROR: $res" -icon error
+ } else {
+ tk_messageBox -default ok -message "Modified Firmware Built successfully!" -icon info
+ }
+ enable_gui
+ }
+
+ proc print_log {msg {tag {}}} {
+ if {[winfo exists .middle.log]} {
+ .middle.log configure -state normal
+ .middle.log insert end "$msg\n" $tag
+ .middle.log configure -state disabled
+ .middle.log yview end
+ }
+ }
+
+ proc hijack_logs { } {
+ rename ::log ::log_orig
+
+ proc ::log {msg {force 0}} {
+ if {$force} {
+ ::gui::print_log $msg warning
+ } else {
+ ::gui::print_log $msg
+ }
+ ::log_orig $msg $force
+ update
+ }
+ rename ::die ::die_orig
+
+ proc ::die {message} {
+ log "FATAL ERROR: $message" 1
+ ::gui::print_log "See $::LOG_FILE for more info" warning
+ ::gui::print_log "Last lines of log : " warning
+ ::gui::print_log "*****************" warning
+ catch {::gui::print_log [tail $::LOG_FILE] warning}
+ ::gui::print_log "*****************" warning
+ error $message
+ }
+ rename ::debug ::debug_orig
+
+ proc ::debug {msg} {
+ update
+ ::debug_orig $msg
+ }
+ }
+}
View
137 ps3mfw_tasks.tcl
@@ -0,0 +1,137 @@
+#!/usr/bin/tclsh
+#
+# ps3mfw -- PS3 MFW creator
+#
+# Copyright (C) Anonymous Developers (Code Monkeys)
+#
+# This software is distributed under the terms of the GNU General Public
+# License ("GPL") version 3, as published by the Free Software Foundation.
+#
+
+proc ego {} {
+ puts "PS3MFW Creator v0.1"
+ puts " Copyright (C) 2011 Project PS3MFW"
+ puts " This program comes with ABSOLUTELY NO WARRANTY;"
+ puts " This is free software, and you are welcome to redistribute it"
+ puts " under certain conditions; see COPYING for details."
+ puts ""
+ puts " Developed By :"
+ puts " Anonymous Developers"
+ puts ""
+}
+
+proc ego_gui {} {
+ log "PS3MFW Creator v0.1"
+ log " Copyright (C) 2011 Project PS3MFW"
+ log " This program comes with ABSOLUTELY NO WARRANTY;"
+ log " This is free software, and you are welcome to redistribute it"
+ log " under certain conditions; see COPYING for details."
+ log ""
+ log " Developed By :"
+ log " Anonymous Developers"
+ log ""
+}
+
+proc clean_up { } {
+ log "Deleting output files"
+ catch_die {file delete -force -- $::CUSTOM_PUP_DIR $::ORIGINAL_PUP_DIR $::OUT_FILE} \
+ "Could not cleanup output files"
+}
+
+proc unpack_source_pup {pup dest} {
+ log "Unpacking source PUP [file tail $pup]"
+ catch_die {pup_extract $pup $dest} "Error extracting PUP file [file tail $pup]"
+
+ # Check for license.txt for people using older version of ps3tools
+ set license_txt [file join $::CUSTOM_UPDATE_DIR license.txt]
+ if {![file exists $::CUSTOM_LICENSE_XML] && [file exists $license_txt]} {
+ set ::CUSTOM_LICENSE_XML $license_txt
+ }
+}
+
+proc pack_custom_pup {dir pup} {
+ global options
+
+ set build $options(--custom-pup-version)
+ if {$build == "" || ![string is integer $build]} {
+ log "Getting build version from [file tail $::IN_FILE]"
+ set build [get_build_version $::IN_FILE]
+ incr build
+ log "Found build version: $build"
+ }
+ # create pup
+ log "Packing Modified PUP [file tail $pup]"
+ catch_die {pup_create $dir $pup $build} "Error packing PUP file [file tail $pup]"
+}
+
+proc change_version {prefix suffix {clear 0}} {
+ global options
+
+ if {$clear} {
+ set version ""
+ } else {
+ set fd [open [file join $::CUSTOM_VERSION_TXT] r]
+ set version [string trim [read $fd]]
+ close $fd
+ }
+
+ set fd [open [file join $::CUSTOM_VERSION_TXT] w]
+ puts $fd "${prefix}${version}${suffix}"
+ close $fd
+}
+
+
+proc build_mfw {input output tasks} {
+ global options
+
+ set ::selected_tasks $tasks
+
+ # print out ego info
+ ego_gui
+
+ if {$input == "" || $output == ""} {
+ die "Must specify an input and output file"
+ }
+ if {![file exists $input]} {
+ die "Input file does not exist"
+ }
+
+ log "Selected tasks : $tasks"
+ debug "HOME=[set ::env(HOME)]\nPATH=[set ::env(PATH)]\n"
+
+ clean_up
+
+ # PREPARE PS3UPDAT.PUP for modification
+ unpack_source_pup $input $::CUSTOM_PUP_DIR
+
+ extract_tar $::CUSTOM_UPDATE_TAR $::CUSTOM_UPDATE_DIR
+
+ # copy original PUP to working dir
+ copy_file $::CUSTOM_PUP_DIR $::ORIGINAL_PUP_DIR
+
+ log "Unpacking all dev_flash files"
+ unpkg_devflash_all $::CUSTOM_DEVFLASH_DIR
+
+ # Execute tasks
+ foreach task $tasks {
+ log "******** Running task $task **********"
+ eval [string map {- _} ${task}::main]
+ }
+
+ # RECREATE PS3UPDAT.PUP
+ file delete -force $::CUSTOM_DEVFLASH_DIR
+ set files [lsort [glob -nocomplain -tails -directory $::CUSTOM_UPDATE_DIR *.pkg]]
+ eval lappend files [lsort [glob -nocomplain -tails -directory $::CUSTOM_UPDATE_DIR *.img]]
+ eval lappend files [lsort [glob -nocomplain -tails -directory $::CUSTOM_UPDATE_DIR dev_flash3_*]]
+ eval lappend files [lsort [glob -nocomplain -tails -directory $::CUSTOM_UPDATE_DIR dev_flash_*]]
+ create_tar $::CUSTOM_UPDATE_TAR $::CUSTOM_UPDATE_DIR $files
+
+ # Change version.txt value
+ if {$options(--custom-version-string) != ""} {
+ change_version $options(--custom-version-string) "" 1
+ } else {
+ change_version $options(--version-prefix) $options(--version-suffix)
+ }